From: Rakesh Pandit Date: Tue, 9 May 2017 14:48:25 +0000 (-0600) Subject: nvme: lightnvm: fix memory leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fba704b494fdc6816a039a66887274b4e5c00eeb;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git nvme: lightnvm: fix memory leak Free up kmalloc allocated memory if failure happens while handling L2P table transfer in nvme_nvm_get_l2p_tbl. Fixes: 8e79b5cb ("lightnvm: move block provisioning to targets") Signed-off-by: Rakesh Pandit Reviewed-by: Javier González Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 206bfdbc1c98..f5df78ed1e10 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -367,7 +367,8 @@ static int nvme_nvm_get_l2p_tbl(struct nvm_dev *nvmdev, u64 slba, u32 nlb, if (unlikely(elba > nvmdev->total_secs)) { pr_err("nvm: L2P data from device is out of bounds!\n"); - return -EINVAL; + ret = -EINVAL; + goto out; } /* Transform physical address to target address space */