[PATCH 1/2] nvmet: Fix memory leak in nvmet_alloc_ctrl()
Wu Bo
wubo40 at huawei.com
Tue May 18 22:01:09 PDT 2021
From: Wu Bo <wubo40 at huawei.com>
When creating ctrl in nvmet_alloc_ctrl(), if the cntlid_min is
large than cntlid_max of the subsystem, and jumps to
"out_free_changed_ns_list" label, but the ctrl->sqs lack of be freed.
So to fix this issuse modify jumps to "out_free_sqs" label.
Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable")
Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs")
Signed-off-by: Wu Bo <wubo40 at huawei.com>
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.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 25cc2ee..1853db3 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,
--
1.8.3.1
More information about the Linux-nvme
mailing list