WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] blktapctl: fix device minor number leak

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] blktapctl: fix device minor number leak
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Mon, 3 Mar 2008 15:07:18 +0900
Delivery-date: Sun, 02 Mar 2008 22:07:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This patch fixes a potential device minor number leak in blktapctl.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 9049b0b62e08 tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Fri Feb 29 10:30:28 2008 +0000
+++ b/tools/blktap/drivers/blktapctrl.c Mon Mar 03 14:43:33 2008 +0900
@@ -518,7 +518,7 @@ int blktapctrl_new_blkif(blkif_t *blkif)
                if (test_path(blk->params, &ptr, &type, &exist) != 0) {
                         DPRINTF("Error in blktap device string(%s).\n",
                                 blk->params);
-                        return -1;
+                        goto fail;
                 }
                blkif->drivertype = type;
                blkif->cookie = next_cookie++;
@@ -527,11 +527,11 @@ int blktapctrl_new_blkif(blkif_t *blkif)
                        DPRINTF("Process does not exist:\n");
                        if (asprintf(&rdctldev,
                                     "%s/tapctrlread%d", BLKTAP_CTRL_DIR, 
minor) == -1)
-                               return -1;
+                               goto fail;
                        if (asprintf(&wrctldev,
                                     "%s/tapctrlwrite%d", BLKTAP_CTRL_DIR, 
minor) == -1) {
                                free(rdctldev);
-                               return -1;
+                               goto fail;
                        }
                        blkif->fds[READ] = open_ctrl_socket(rdctldev);
                        blkif->fds[WRITE] = open_ctrl_socket(wrctldev);
@@ -543,7 +543,7 @@ int blktapctrl_new_blkif(blkif_t *blkif)
                        DPRINTF("Launching process, CMDLINE [tapdisk %s 
%s]\n",wrctldev, rdctldev);
                        if (launch_tapdisk(wrctldev, rdctldev) == -1) {
                                DPRINTF("Unable to fork, cmdline: [tapdisk %s 
%s]\n",wrctldev, rdctldev);
-                               return -1;
+                               goto fail;
                        }
 
                        free(rdctldev);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] blktapctl: fix device minor number leak, Kouya Shimura <=