linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: lightnvm: fix memory leak
@ 2017-05-09 13:55 Rakesh Pandit
  2017-05-09 13:59 ` Javier González
  0 siblings, 1 reply; 3+ messages in thread
From: Rakesh Pandit @ 2017-05-09 13:55 UTC (permalink / raw)
  To: linux-nvme
  Cc: linux-kernel, Matias Bjørling, Christoph Hellwig,
	Javier González, Jens Axboe

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvme: lightnvm: fix memory leak
  2017-05-09 13:55 [PATCH] nvme: lightnvm: fix memory leak Rakesh Pandit
@ 2017-05-09 13:59 ` Javier González
  2017-05-09 14:49   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Javier González @ 2017-05-09 13:59 UTC (permalink / raw)
  To: Rakesh Pandit
  Cc: linux-nvme, linux-kernel, Matias Bjørling,
	Christoph Hellwig, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

> 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>


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvme: lightnvm: fix memory leak
  2017-05-09 13:59 ` Javier González
@ 2017-05-09 14:49   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-05-09 14:49 UTC (permalink / raw)
  To: Javier González, Rakesh Pandit
  Cc: linux-nvme, linux-kernel, Matias Bjørling, Christoph Hellwig

On 05/09/2017 07:59 AM, Javier González wrote:
>> 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>

Added for this series.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-09 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 13:55 [PATCH] nvme: lightnvm: fix memory leak Rakesh Pandit
2017-05-09 13:59 ` Javier González
2017-05-09 14:49   ` 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).