Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638134 > unrolled thread

[PATCH] nvme: lightnvm: fix memory leak

Started byRakesh Pandit <rakesh@tuxera.com>
First post2017-05-09 16:00 +0200
Last post2017-05-09 16:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] nvme: lightnvm: fix memory leak Rakesh Pandit <rakesh@tuxera.com> - 2017-05-09 16:00 +0200
    Re: [PATCH] nvme: lightnvm: fix memory leak Javier González <jg@lightnvm.io> - 2017-05-09 16:10 +0200

#1638134 — [PATCH] nvme: lightnvm: fix memory leak

FromRakesh Pandit <rakesh@tuxera.com>
Date2017-05-09 16:00 +0200
Subject[PATCH] nvme: lightnvm: fix memory leak
Message-ID<tFdQf-2qF-21@gated-at.bofh.it>
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 <rakesh@tuxera.com>
---
 drivers/nvme/host/lightnvm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 206bfdb..f5df78e 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 */
-- 
2.5.5

[toc] | [next] | [standalone]


#1638139

FromJavier González <jg@lightnvm.io>
Date2017-05-09 16:10 +0200
Message-ID<tFdZU-2JX-13@gated-at.bofh.it>
In reply to#1638134

[Multipart message — attachments visible in raw view] — view raw

> On 9 May 2017, at 15.55, Rakesh Pandit <rakesh@tuxera.com> wrote:
> 
> 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 <rakesh@tuxera.com>
> ---
> drivers/nvme/host/lightnvm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
> index 206bfdb..f5df78e 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 */
> --
> 2.5.5

Looks good. Thanks Rakesh.

Reviewed-by: Javier González <javier@cnexlabs.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web