All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
@ 2021-05-18  8:46 ` Wu Bo
  0 siblings, 0 replies; 8+ messages in thread
From: Wu Bo @ 2021-05-18  8:46 UTC (permalink / raw)
  To: hch, sagi, chaitanya.kulkarni, kbusch, amit.engel, linux-nvme,
	linux-kernel
  Cc: linfeilong, wubo40

From: Wu Bo <wubo40@huawei.com>

When cntlid_min is greater than cntlid_max,
goto wrong label, should be goto out_free_sqs
label. Otherwise there is a memory leak problem
on the nvmet_alloc_ctrl function().

Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
Signed-off-by: Wu Bo <wubo40@huawei.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 25cc2ee8de3f..1853db38b682 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 		goto out_free_changed_ns_list;
 
 	if (subsys->cntlid_min > subsys->cntlid_max)
-		goto out_free_changed_ns_list;
+		goto out_free_sqs;
 
 	ret = ida_simple_get(&cntlid_ida,
 			     subsys->cntlid_min, subsys->cntlid_max,
-- 
2.30.0


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

* [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
@ 2021-05-18  8:46 ` Wu Bo
  0 siblings, 0 replies; 8+ messages in thread
From: Wu Bo @ 2021-05-18  8:46 UTC (permalink / raw)
  To: hch, sagi, chaitanya.kulkarni, kbusch, amit.engel, linux-nvme,
	linux-kernel
  Cc: linfeilong, wubo40

From: Wu Bo <wubo40@huawei.com>

When cntlid_min is greater than cntlid_max,
goto wrong label, should be goto out_free_sqs
label. Otherwise there is a memory leak problem
on the nvmet_alloc_ctrl function().

Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
Signed-off-by: Wu Bo <wubo40@huawei.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 25cc2ee8de3f..1853db38b682 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 		goto out_free_changed_ns_list;
 
 	if (subsys->cntlid_min > subsys->cntlid_max)
-		goto out_free_changed_ns_list;
+		goto out_free_sqs;
 
 	ret = ida_simple_get(&cntlid_ida,
 			     subsys->cntlid_min, subsys->cntlid_max,
-- 
2.30.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
  2021-05-18  8:46 ` Wu Bo
@ 2021-05-18 17:59   ` Sagi Grimberg
  -1 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2021-05-18 17:59 UTC (permalink / raw)
  To: Wu Bo, hch, chaitanya.kulkarni, kbusch, amit.engel, linux-nvme,
	linux-kernel
  Cc: linfeilong

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
@ 2021-05-18 17:59   ` Sagi Grimberg
  0 siblings, 0 replies; 8+ messages in thread
From: Sagi Grimberg @ 2021-05-18 17:59 UTC (permalink / raw)
  To: Wu Bo, hch, chaitanya.kulkarni, kbusch, amit.engel, linux-nvme,
	linux-kernel
  Cc: linfeilong

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
  2021-05-18  8:46 ` Wu Bo
@ 2021-05-18 20:27   ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-05-18 20:27 UTC (permalink / raw)
  To: Wu Bo, kbusch; +Cc: hch, sagi, amit.engel, linux-nvme, linux-kernel, linfeilong

On 5/18/21 01:21, Wu Bo wrote:
> From: Wu Bo <wubo40@huawei.com>
>
> When cntlid_min is greater than cntlid_max,
> goto wrong label, should be goto out_free_sqs
> label. Otherwise there is a memory leak problem
> on the nvmet_alloc_ctrl function().
>
> Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
> Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---

Looks good, except commit message could be better :-

When cntlid_min is greater than cntlid_max, goto wrong label, should be
goto out_free_sqs label. Otherwise there is a memory leak problem on the
nvmet_alloc_ctrl function(). 

Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
Fixes: 6d65aeab7bf6 ("nvmet: remove unused ctrl->cqs")
Signed-off-by: Wu Bo <wubo40@huawei.com>


with above :-

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>



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

* Re: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
@ 2021-05-18 20:27   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-05-18 20:27 UTC (permalink / raw)
  To: Wu Bo, kbusch; +Cc: hch, sagi, amit.engel, linux-nvme, linux-kernel, linfeilong

On 5/18/21 01:21, Wu Bo wrote:
> From: Wu Bo <wubo40@huawei.com>
>
> When cntlid_min is greater than cntlid_max,
> goto wrong label, should be goto out_free_sqs
> label. Otherwise there is a memory leak problem
> on the nvmet_alloc_ctrl function().
>
> Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
> Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---

Looks good, except commit message could be better :-

When cntlid_min is greater than cntlid_max, goto wrong label, should be
goto out_free_sqs label. Otherwise there is a memory leak problem on the
nvmet_alloc_ctrl function(). 

Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
Fixes: 6d65aeab7bf6 ("nvmet: remove unused ctrl->cqs")
Signed-off-by: Wu Bo <wubo40@huawei.com>


with above :-

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>



_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
  2021-05-18 20:27   ` Chaitanya Kulkarni
@ 2021-05-19  4:32     ` Wu Bo
  -1 siblings, 0 replies; 8+ messages in thread
From: Wu Bo @ 2021-05-19  4:32 UTC (permalink / raw)
  To: Chaitanya Kulkarni, kbusch
  Cc: hch, sagi, amit.engel, linux-nvme, linux-kernel, linfeilong

On 2021/5/19 4:27, Chaitanya Kulkarni wrote:
> On 5/18/21 01:21, Wu Bo wrote:
>> From: Wu Bo <wubo40@huawei.com>
>>
>> When cntlid_min is greater than cntlid_max,
>> goto wrong label, should be goto out_free_sqs
>> label. Otherwise there is a memory leak problem
>> on the nvmet_alloc_ctrl function().
>>
>> Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
>> Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
>> Signed-off-by: Wu Bo <wubo40@huawei.com>
>> ---
> 
> Looks good, except commit message could be better :-
> 
> When cntlid_min is greater than cntlid_max, goto wrong label, should be
> goto out_free_sqs label. Otherwise there is a memory leak problem on the
> nvmet_alloc_ctrl function().
> 
> Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
> Fixes: 6d65aeab7bf6 ("nvmet: remove unused ctrl->cqs")
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> 
> 
> with above :-

Thanks for your review. I will make the commit message better.
and I found the nvmet-loop has a similar issue,
will send patch series soon.

Thanks,
Wu Bo
> 
> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> 
> 
> .
> 


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

* Re: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
@ 2021-05-19  4:32     ` Wu Bo
  0 siblings, 0 replies; 8+ messages in thread
From: Wu Bo @ 2021-05-19  4:32 UTC (permalink / raw)
  To: Chaitanya Kulkarni, kbusch
  Cc: hch, sagi, amit.engel, linux-nvme, linux-kernel, linfeilong

On 2021/5/19 4:27, Chaitanya Kulkarni wrote:
> On 5/18/21 01:21, Wu Bo wrote:
>> From: Wu Bo <wubo40@huawei.com>
>>
>> When cntlid_min is greater than cntlid_max,
>> goto wrong label, should be goto out_free_sqs
>> label. Otherwise there is a memory leak problem
>> on the nvmet_alloc_ctrl function().
>>
>> Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
>> Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
>> Signed-off-by: Wu Bo <wubo40@huawei.com>
>> ---
> 
> Looks good, except commit message could be better :-
> 
> When cntlid_min is greater than cntlid_max, goto wrong label, should be
> goto out_free_sqs label. Otherwise there is a memory leak problem on the
> nvmet_alloc_ctrl function().
> 
> Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
> Fixes: 6d65aeab7bf6 ("nvmet: remove unused ctrl->cqs")
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> 
> 
> with above :-

Thanks for your review. I will make the commit message better.
and I found the nvmet-loop has a similar issue,
will send patch series soon.

Thanks,
Wu Bo
> 
> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> 
> 
> .
> 


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2021-05-19  4:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18  8:46 [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl() Wu Bo
2021-05-18  8:46 ` Wu Bo
2021-05-18 17:59 ` Sagi Grimberg
2021-05-18 17:59   ` Sagi Grimberg
2021-05-18 20:27 ` Chaitanya Kulkarni
2021-05-18 20:27   ` Chaitanya Kulkarni
2021-05-19  4:32   ` Wu Bo
2021-05-19  4:32     ` Wu Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.