Skip to content

Commit a70985f

Browse files
Wei Yongjunaxboe
authored andcommitted
lightnvm: pblk: fix error handling of pblk_lines_init()
In the too many bad blocks error handling case, we should release all the allocated resources, otherwise it will cause memory leak. Fixes: 2deeefc ("lightnvm: pblk: fail gracefully on line alloc. failure") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Hans Holmberg <hans.holmberg@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6fd05ca commit a70985f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/lightnvm/pblk-init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,8 @@ static int pblk_lines_init(struct pblk *pblk)
10241024

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

10301031
pblk_set_provision(pblk, nr_free_chks);

0 commit comments

Comments
 (0)