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

Commit d4ab0df8 authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman
Browse files

lightnvm: pblk: fix error handling of pblk_lines_init()



[ Upstream commit a70985f83c625a5eaf618be81621e5e4521a66c6 ]

In the too many bad blocks error handling case, we should release all
the allocated resources, otherwise it will cause memory leak.

Fixes: 2deeefc0 ("lightnvm: pblk: fail gracefully on line alloc. failure")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarHans Holmberg <hans.holmberg@cnexlabs.com>
Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent cdf73455
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1084,7 +1084,8 @@ static int pblk_lines_init(struct pblk *pblk)

	if (!nr_free_chks) {
		pblk_err(pblk, "too many bad blocks prevent for sane instance\n");
		return -EINTR;
		ret = -EINTR;
		goto fail_free_lines;
	}

	pblk_set_provision(pblk, nr_free_chks);