diff options
author | Bob Liu <bob.liu@oracle.com> | 2016-07-27 05:42:04 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2016-08-19 12:31:59 -0400 |
commit | 4e876c2bd37fbb5c37a4554a79cf979d486f0e82 (patch) | |
tree | 952f4cda64e34b387976e7321febe6571f37f199 | |
parent | 172335ada40ce26806e514c83a504b45c14a4139 (diff) |
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>
-rw-r--r-- | drivers/block/xen-blkfront.c | 7 |
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) | |||
2442 | if (err) { | 2442 | if (err) { |
2443 | xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", | 2443 | xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", |
2444 | info->xbdev->otherend); | 2444 | info->xbdev->otherend); |
2445 | return; | 2445 | goto fail; |
2446 | } | 2446 | } |
2447 | 2447 | ||
2448 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 2448 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
@@ -2455,6 +2455,11 @@ static void blkfront_connect(struct blkfront_info *info) | |||
2455 | device_add_disk(&info->xbdev->dev, info->gd); | 2455 | device_add_disk(&info->xbdev->dev, info->gd); |
2456 | 2456 | ||
2457 | info->is_ready = 1; | 2457 | info->is_ready = 1; |
2458 | return; | ||
2459 | |||
2460 | fail: | ||
2461 | blkif_free(info, 0); | ||
2462 | return; | ||
2458 | } | 2463 | } |
2459 | 2464 | ||
2460 | /** | 2465 | /** |