summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChaitanya Kulkarni <ckulkarnilinux@gmail.com>2025-12-20 03:18:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-02-11 15:39:12 +0300
commit7c54d3f5ebbc5982daaa004260242dc07ac943ea (patch)
tree0c7f55bdc8d5cb3955fd870eed03c165628f8f0e /drivers
parent1d395dae332ba04528aa25adbae855b3b05bd0ea (diff)
downloadlinux-7c54d3f5ebbc5982daaa004260242dc07ac943ea.tar.xz
nvme-fc: release admin tagset if init fails
[ Upstream commit d1877cc7270302081a315a81a0ee8331f19f95c8 ] nvme_fabrics creates an NVMe/FC controller in following path: nvmf_dev_write() -> nvmf_create_ctrl() -> nvme_fc_create_ctrl() -> nvme_fc_init_ctrl() nvme_fc_init_ctrl() allocates the admin blk-mq resources right after nvme_add_ctrl() succeeds. If any of the subsequent steps fail (changing the controller state, scheduling connect work, etc.), we jump to the fail_ctrl path, which tears down the controller references but never frees the admin queue/tag set. The leaked blk-mq allocations match the kmemleak report seen during blktests nvme/fc. Check ctrl->ctrl.admin_tagset in the fail_ctrl path and call nvme_remove_admin_tag_set() when it is set so that all admin queue allocations are reclaimed whenever controller setup aborts. Reported-by: Yi Zhang <yi.zhang@redhat.com> Reviewed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/fc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 4fdb62ae996b..44de1bcd0c65 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3550,6 +3550,8 @@ fail_ctrl:
ctrl->ctrl.opts = NULL;
+ if (ctrl->ctrl.admin_tagset)
+ nvme_remove_admin_tag_set(&ctrl->ctrl);
/* initiate nvme ctrl ref counting teardown */
nvme_uninit_ctrl(&ctrl->ctrl);