Skip to content

Commit fec356a

Browse files
Wu BoChristoph Hellwig
authored andcommitted
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: 94a39d6 ("nvmet: make ctrl-id configurable") Signed-off-by: Wu Bo <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 4bc2082 commit fec356a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/target/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
13721372
goto out_free_changed_ns_list;
13731373

13741374
if (subsys->cntlid_min > subsys->cntlid_max)
1375-
goto out_free_changed_ns_list;
1375+
goto out_free_sqs;
13761376

13771377
ret = ida_simple_get(&cntlid_ida,
13781378
subsys->cntlid_min, subsys->cntlid_max,

0 commit comments

Comments
 (0)