]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
lightnvm: pblk: fix error handling of pblk_lines_init()
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 9 Oct 2018 11:12:13 +0000 (13:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:20:52 +0000 (08:20 +0100)
[ 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>
drivers/lightnvm/pblk-init.c

index dc32274881b2fae0a755719ea0f4bb2e08f45d2d..91fd2b291db91125790cb95a9e4f562b18b275be 100644 (file)
@@ -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);