summaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkfront.c
diff options
context:
space:
mode:
authorBob Liu <bob.liu@oracle.com>2016-07-27 11:42:04 +0200
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2016-08-19 18:31:59 +0200
commit4e876c2bd37fbb5c37a4554a79cf979d486f0e82 (patch)
tree952f4cda64e34b387976e7321febe6571f37f199 /drivers/block/xen-blkfront.c
parentxen-blkfront: introduce blkif_set_queue_limits() (diff)
downloadlinux-4e876c2bd37fbb5c37a4554a79cf979d486f0e82.tar.xz
linux-4e876c2bd37fbb5c37a4554a79cf979d486f0e82.zip
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>
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r--drivers/block/xen-blkfront.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index f84e220a26e6..88ef6d4729b4 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -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;
}
/**