Thread (85 messages) 85 messages, 10 authors, 2017-09-06

Re: [PATCH 01/19] bcache: Fix leak of bdev reference

From: Coly Li <hidden>
Date: 2017-07-01 16:55:06
Also in: linux-bcache, stable

On 2017/7/1 上午4:42, bcache@lists.ewheeler.net wrote:
From: Jan Kara <jack@suse.cz>

If blkdev_get_by_path() in register_bcache() fails, we try to lookup the
block device using lookup_bdev() to detect which situation we are in to
properly report error. However we never drop the reference returned to
us from lookup_bdev(). Fix that.

Signed-off-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
Acked-by: Coly Li <redacted>

Thanks.
quoted hunk ↗ jump to hunk
---
 drivers/md/bcache/super.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 8352fad..9a2c190 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1964,6 +1964,8 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 			else
 				err = "device busy";
 			mutex_unlock(&bch_register_lock);
+			if (!IS_ERR(bdev))
+				bdput(bdev);
 			if (attr == &ksysfs_register_quiet)
 				goto out;
 		}

-- 
Coly Li
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help