Skip to content

Commit

Permalink
lightnvm: pblk: fix error handling of pblk_lines_init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Jens Axboe committed Oct 9, 2018
1 parent 6fd05ca commit a70985f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/lightnvm/pblk-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,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);
Expand Down

0 comments on commit a70985f

Please sign in to comment.