linux/drivers/nvme/host
Chaitanya Kulkarni fa301aef50 nvme-fc: release admin tagset if init fails
[ Upstream commit d1877cc727 ]

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>
History 2026-02-11 13:40:22 +01:00
..
apple.c block: add a rq_list type 2025-04-25 10:48:06 +02:00
auth.c nvme-auth: use kvfree() for memory allocated with kvcalloc() 2025-12-18 13:55:19 +01:00
constants.c nvme: fix command limits status code 2025-06-19 15:32:18 +02:00
core.c nvme: fix admin request_queue lifetime 2025-12-12 18:37:20 +01:00
fabrics.c nvme-fabrics: add ENOKEY to no retry criteria for authentication failures 2026-01-08 10:14:12 +01:00
fabrics.h nvme-pci: do not directly handle subsys reset fallout 2024-06-26 07:02:22 -07:00
fault_inject.c fault-inject: improve build for CONFIG_FAULT_INJECTION=n 2024-09-01 20:43:33 -07:00
fc.c nvme-fc: release admin tagset if init fails 2026-02-11 13:40:22 +01:00
fc.h nvme-fc: Update header and host for common definitions for LS handling 2020-05-09 16:18:33 -06:00
hwmon.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
ioctl.c nvme: always punt polled uring_cmd end_io work to task_work 2025-06-27 11:11:38 +01:00
Kconfig nvme-tcp: select CONFIG_TLS from CONFIG_NVME_TCP_TLS 2025-05-09 09:50:46 +02:00
Makefile nvme: rework NVME_AUTH Kconfig selection 2023-10-12 08:04:49 -07:00
multipath.c nvme-multipath: fix lockdep WARN due to partition scan work 2025-12-01 11:43:31 +01:00
nvme.h nvme-pci: add support for sgl metadata 2025-03-13 13:02:01 +01:00
pci.c nvme: fix PCIe subsystem reset controller state transition 2026-01-23 11:18:46 +01:00
pr.c nvme: fix command limits status code 2025-06-19 15:32:18 +02:00
rdma.c nvme-rdma: unquiesce admin_q before destroy it 2024-12-14 20:03:17 +01:00
sysfs.c nvme: make nvme_tls_attrs_group static 2025-02-17 10:04:59 +01:00
tcp.c nvme/tcp: handle tls partially sent records in write_space() 2025-10-23 16:20:38 +02:00
trace.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
trace.h nvme: fix async event trace event 2023-04-13 08:59:04 +02:00
zns.c block: Remove REQ_OP_ZONE_RESET_ALL emulation 2024-07-05 00:42:04 -06:00