* [PATCH][next] lightnvm: pblk: fix resource leak of invalid_bitmap
@ 2018-06-05 15:14 Colin King
2018-06-05 15:20 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-06-05 15:14 UTC (permalink / raw)
To: Matias Bjorling, linux-block; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the error exit path when the emeta could not be
interpreted is via fail_free_ws and this fails to free
invalid_bitmap. Fix this by adding another exit label and
exiting via this to kfree invalid_bitmap.
Detected by CoverityScan, CID#1469659 ("Resource leak")
Fixes: 48b8d20895f8 ("lightnvm: pblk: garbage collect lines with failed writes")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/lightnvm/pblk-gc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
index df88f1bdd921..31a0a1b3868b 100644
--- a/drivers/lightnvm/pblk-gc.c
+++ b/drivers/lightnvm/pblk-gc.c
@@ -203,7 +203,7 @@ static void pblk_gc_line_prepare_ws(struct work_struct *work)
if (!lba_list) {
pr_err("pblk: could not interpret emeta (line %d)\n",
line->id);
- goto fail_free_ws;
+ goto fail_free_invalid_bitmap;
}
}
@@ -280,6 +280,7 @@ static void pblk_gc_line_prepare_ws(struct work_struct *work)
kfree(gc_rq);
fail_free_lba_list:
pblk_mfree(lba_list, l_mg->emeta_alloc_type);
+fail_free_invalid_bitmap:
kfree(invalid_bitmap);
fail_free_ws:
kfree(line_ws);
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] lightnvm: pblk: fix resource leak of invalid_bitmap
2018-06-05 15:14 [PATCH][next] lightnvm: pblk: fix resource leak of invalid_bitmap Colin King
@ 2018-06-05 15:20 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-06-05 15:20 UTC (permalink / raw)
To: Colin King, Matias Bjorling, linux-block; +Cc: kernel-janitors, linux-kernel
On 6/5/18 9:14 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the error exit path when the emeta could not be
> interpreted is via fail_free_ws and this fails to free
> invalid_bitmap. Fix this by adding another exit label and
> exiting via this to kfree invalid_bitmap.
>
> Detected by CoverityScan, CID#1469659 ("Resource leak")
Looks good, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-05 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 15:14 [PATCH][next] lightnvm: pblk: fix resource leak of invalid_bitmap Colin King
2018-06-05 15:20 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).