path: root/drivers/nvme
diff options
authorWu Bo <>2021-05-19 13:01:09 +0800
committerChristoph Hellwig <>2021-05-19 08:33:39 +0200
commitfec356a61aa3d3a66416b4321f1279e09e0f256f (patch)
tree8a02dec924fd6f5cbbf6c8ba6e690f38a5b1e760 /drivers/nvme
parent4bc2082311311892742deb2ce04bc335f85ee27a (diff)
nvmet: fix memory leak in nvmet_alloc_ctrl()
When creating ctrl in nvmet_alloc_ctrl(), if the cntlid_min is larger than cntlid_max of the subsystem, and jumps to the "out_free_changed_ns_list" label, but the ctrl->sqs lack of be freed. Fix this by jumping to the "out_free_sqs" label. Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable") Signed-off-by: Wu Bo <> Reviewed-by: Sagi Grimberg <> Reviewed-by: Chaitanya Kulkarni <> Signed-off-by: Christoph Hellwig <>
Diffstat (limited to 'drivers/nvme')
1 files changed, 1 insertions, 1 deletions
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,