Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d9e06d6 authored by Wei Yongjun's avatar Wei Yongjun Committed by Jens Axboe
Browse files

bcache: fix possible memory leak in bch_cached_dev_run()



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: 0b13efec ("bcache: add return value check to bch_cached_dev_run()")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarColy Li <colyli@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9310a7ba
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
	}