ia64/xen-unstable

changeset 17172:990eb630033a

blktapctrl: Fix a potential device minor number leak.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 03 11:08:10 2008 +0000 (2008-03-03)
parents 69bb0c4af952
children a142ddb40b1c
files tools/blktap/drivers/blktapctrl.c
line diff
     1.1 --- a/tools/blktap/drivers/blktapctrl.c	Mon Mar 03 11:06:31 2008 +0000
     1.2 +++ b/tools/blktap/drivers/blktapctrl.c	Mon Mar 03 11:08:10 2008 +0000
     1.3 @@ -518,7 +518,7 @@ int blktapctrl_new_blkif(blkif_t *blkif)
     1.4  		if (test_path(blk->params, &ptr, &type, &exist) != 0) {
     1.5                          DPRINTF("Error in blktap device string(%s).\n",
     1.6                                  blk->params);
     1.7 -                        return -1;
     1.8 +                        goto fail;
     1.9                  }
    1.10  		blkif->drivertype = type;
    1.11  		blkif->cookie = next_cookie++;
    1.12 @@ -527,11 +527,11 @@ int blktapctrl_new_blkif(blkif_t *blkif)
    1.13  			DPRINTF("Process does not exist:\n");
    1.14  			if (asprintf(&rdctldev,
    1.15  				     "%s/tapctrlread%d", BLKTAP_CTRL_DIR, minor) == -1)
    1.16 -				return -1;
    1.17 +				goto fail;
    1.18  			if (asprintf(&wrctldev,
    1.19  				     "%s/tapctrlwrite%d", BLKTAP_CTRL_DIR, minor) == -1) {
    1.20  				free(rdctldev);
    1.21 -				return -1;
    1.22 +				goto fail;
    1.23  			}
    1.24  			blkif->fds[READ] = open_ctrl_socket(rdctldev);
    1.25  			blkif->fds[WRITE] = open_ctrl_socket(wrctldev);
    1.26 @@ -543,7 +543,7 @@ int blktapctrl_new_blkif(blkif_t *blkif)
    1.27   			DPRINTF("Launching process, CMDLINE [tapdisk %s %s]\n",wrctldev, rdctldev);
    1.28   			if (launch_tapdisk(wrctldev, rdctldev) == -1) {
    1.29   				DPRINTF("Unable to fork, cmdline: [tapdisk %s %s]\n",wrctldev, rdctldev);
    1.30 -				return -1;
    1.31 +				goto fail;
    1.32  			}
    1.33  
    1.34  			free(rdctldev);