Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451809

[PATCH 3/3] xen-blkfront: free resources if xlvbd_alloc_gendisk fails

From Bob Liu <bob.liu@oracle.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] xen-blkfront: free resources if xlvbd_alloc_gendisk fails
Date 2016-07-28 11:10 +0200
Message-ID <rZPuh-48F-5@gated-at.bofh.it> (permalink)
References <rZPuh-48F-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/block/xen-blkfront.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index d5ed60b..d8429d4 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2446,7 +2446,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);
@@ -2459,6 +2459,11 @@ static void blkfront_connect(struct blkfront_info *info)
 	add_disk(info->gd);
 
 	info->is_ready = 1;
+	return;
+
+fail:
+	blkif_free(info, 0);
+	return;
 }
 
 /**
-- 
1.7.10.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/3] xen-blkfront: fix places not updated after introducing 64KB page granularity Bob Liu <bob.liu@oracle.com> - 2016-07-28 11:10 +0200
  [PATCH 3/3] xen-blkfront: free resources if xlvbd_alloc_gendisk fails Bob Liu <bob.liu@oracle.com> - 2016-07-28 11:10 +0200
  [PATCH v2 2/3] xen-blkfront: introduce blkif_set_queue_limits() Bob Liu <bob.liu@oracle.com> - 2016-07-28 11:10 +0200

csiph-web