[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1621327598-542045-1-git-send-email-wubo40@huawei.com>
Date: Tue, 18 May 2021 16:46:38 +0800
From: Wu Bo <wubo40@...wei.com>
To: <hch@....de>, <sagi@...mberg.me>, <chaitanya.kulkarni@....com>,
<kbusch@...nel.org>, <amit.engel@...l.com>,
<linux-nvme@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC: <linfeilong@...wei.com>, <wubo40@...wei.com>
Subject: [PATCH] nvmet: fix memory leak on nvmet_alloc_ctrl()
From: Wu Bo <wubo40@...wei.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@...wei.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
Powered by blists - more mailing lists