Skip to content

Commit

Permalink
lightnvm: pblk: fix error path in pblk_lines_alloc_metadata
Browse files Browse the repository at this point in the history
Use appropriate memory free calls based on allocation type used and
also fix number of times free is called if kmalloc fails.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Reviewed-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Rakesh Pandit authored and Jens Axboe committed Oct 13, 2017
1 parent a96d50f commit c9d84b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/lightnvm/pblk-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,10 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk)

fail_free_emeta:
while (--i >= 0) {
vfree(l_mg->eline_meta[i]->buf);
if (l_mg->emeta_alloc_type == PBLK_VMALLOC_META)
vfree(l_mg->eline_meta[i]->buf);
else
kfree(l_mg->eline_meta[i]->buf);
kfree(l_mg->eline_meta[i]);
}

Expand Down

0 comments on commit c9d84b3

Please sign in to comment.