diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-10-09 07:12:13 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-10-09 10:25:08 -0400 |
commit | a70985f83c625a5eaf618be81621e5e4521a66c6 (patch) | |
tree | 43ba48e94d8a631a52eda2ef14c5abf107e1c8e8 /drivers/lightnvm/pblk-init.c | |
parent | 6fd05cad5ee1290b276dd8ed90a1e019b1fa577a (diff) |
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: 2deeefc02dff ("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>
Diffstat (limited to 'drivers/lightnvm/pblk-init.c')
-rw-r--r-- | drivers/lightnvm/pblk-init.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index e0db0cb3122d..e3573880dbda 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c | |||
@@ -1024,7 +1024,8 @@ static int pblk_lines_init(struct pblk *pblk) | |||
1024 | 1024 | ||
1025 | if (!nr_free_chks) { | 1025 | if (!nr_free_chks) { |
1026 | pblk_err(pblk, "too many bad blocks prevent for sane instance\n"); | 1026 | pblk_err(pblk, "too many bad blocks prevent for sane instance\n"); |
1027 | return -EINTR; | 1027 | ret = -EINTR; |
1028 | goto fail_free_lines; | ||
1028 | } | 1029 | } |
1029 | 1030 | ||
1030 | pblk_set_provision(pblk, nr_free_chks); | 1031 | pblk_set_provision(pblk, nr_free_chks); |