xen-blkfront: free resources if xlvbd_alloc_gendisk fails

Current code forgets to free resources in the failure path of
xlvbd_alloc_gendisk(), this patch fix it.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
Bob Liu 2016-07-27 17:42:04 +08:00 committed by Konrad Rzeszutek Wilk
parent 172335ada4
commit 4e876c2bd3
1 changed files with 6 additions and 1 deletions

View File

@ -2442,7 +2442,7 @@ static void blkfront_connect(struct blkfront_info *info)
if (err) {
xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s",
info->xbdev->otherend);
return;
goto fail;
}
xenbus_switch_state(info->xbdev, XenbusStateConnected);
@ -2455,6 +2455,11 @@ static void blkfront_connect(struct blkfront_info *info)
device_add_disk(&info->xbdev->dev, info->gd);
info->is_ready = 1;
return;
fail:
blkif_free(info, 0);
return;
}
/**