diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-10-09 14:12:13 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-24 10:20:52 +0300 |
commit | d4ab0df8d5dd109e75adf3382a9e118551c50945 (patch) | |
tree | 48282815416ac2e8179e812cbd25db2ff4e967e1 | |
parent | cdf73455471adec2886e3ec884141ee5558f3c3b (diff) | |
download | linux-d4ab0df8d5dd109e75adf3382a9e118551c50945.tar.xz |
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: 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 dc32274881b2..91fd2b291db9 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -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); |