All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] bcache fix for Linux v5.3-rc2
@ 2019-07-22 14:12 Coly Li
  2019-07-22 14:12 ` [PATCH 1/1] bcache: fix possible memory leak in bch_cached_dev_run() Coly Li
  0 siblings, 1 reply; 3+ messages in thread
From: Coly Li @ 2019-07-22 14:12 UTC (permalink / raw)
  To: axboe; +Cc: linux-bcache, linux-block, Coly Li

Hi Jens,

Up to now we have one fix from Wei Yongjun for the patches merged in
Linux v5.3-rc1, which is for a possible memory leak when running a
cached device.

Thank you in advance, for taking it in v5.3-rc2.

Coly Li
---

Wei Yongjun (1):
  bcache: fix possible memory leak in bch_cached_dev_run()

 drivers/md/bcache/super.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] bcache: fix possible memory leak in bch_cached_dev_run()
  2019-07-22 14:12 [PATCH 0/1] bcache fix for Linux v5.3-rc2 Coly Li
@ 2019-07-22 14:12 ` Coly Li
  2019-07-22 14:15   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Coly Li @ 2019-07-22 14:12 UTC (permalink / raw)
  To: axboe; +Cc: linux-bcache, linux-block, Wei Yongjun, Coly Li

From: Wei Yongjun <weiyongjun1@huawei.com>

memory malloced in bch_cached_dev_run() and should be freed before
leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: 0b13efecf5f2 ("bcache: add return value check to bch_cached_dev_run()")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
 drivers/md/bcache/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 26e374fbf57c..20ed838e9413 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -931,6 +931,9 @@ int bch_cached_dev_run(struct cached_dev *dc)
 	if (dc->io_disable) {
 		pr_err("I/O disabled on cached dev %s",
 		       dc->backing_dev_name);
+		kfree(env[1]);
+		kfree(env[2]);
+		kfree(buf);
 		return -EIO;
 	}
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] bcache: fix possible memory leak in bch_cached_dev_run()
  2019-07-22 14:12 ` [PATCH 1/1] bcache: fix possible memory leak in bch_cached_dev_run() Coly Li
@ 2019-07-22 14:15   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-07-22 14:15 UTC (permalink / raw)
  To: Coly Li; +Cc: linux-bcache, linux-block, Wei Yongjun

On 7/22/19 8:12 AM, Coly Li wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> memory malloced in bch_cached_dev_run() and should be freed before
> leaving from the error handling cases, otherwise it will cause
> memory leak.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-22 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-22 14:12 [PATCH 0/1] bcache fix for Linux v5.3-rc2 Coly Li
2019-07-22 14:12 ` [PATCH 1/1] bcache: fix possible memory leak in bch_cached_dev_run() Coly Li
2019-07-22 14:15   ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.