CVE-2026-142939: nvmet-fc: don't drop the last assoc reference in nvmet_fc_delete_ctrl()
In the Linux kernel, the following vulnerability has been resolved:
nvmet-fc: don't drop the last assoc reference in nvmetfcdeletectrl()
syzbot hit a recursive locking report on subsys->lock when a subsystem is unlinked from an FC port.
nvmetportdelctrls() holds subsys->lock while it calls ->deletectrl() for each controller. nvmetfcdeletectrl() grabs a reference on the association, queues delwork and then drops the reference. If delwork gets to run to completion before that put, ours is the last reference. Freeing the assoc tears down the queues, the last nvmetcqput() drops the last ctrl reference, and nvmetctrlfree() goes for subsys->lock again:
WARNING: possible recursive locking detected ... nvmetctrlfree+0xa6/0x8e0 drivers/nvme/target/core.c:1766 nvmetcqput+0x158/0x200 drivers/nvme/target/core.c:848 nvmetfctargetassocfree+0x418/0x2220 drivers/nvme/target/fc.c:1173 nvmetfcdeletectrl+0x717/0x7e0 drivers/nvme/target/fc.c:1581 nvmetportdelctrls+0xfb/0x150 drivers/nvme/target/core.c:311 nvmetportsubsysdroplink+0x1e8/0x310 drivers/nvme/target/configfs.c:1119
It's a real hang, not only a lockdep warning. I reproduced it with fcloop by putting an msleep() before the put: rm on the configfs link gets stuck in D state for good.
I don't think we need that reference at all. delwork does listdelrcu() and synchronizercu() before it drops the initial reference, so an assoc we find on assoclist can't go away before rcureadunlock(). nvmetfcscheduledeleteassoc() doesn't sleep, so just call it inside the RCU section and get rid of the get/put. If the assoc is already being deleted, terminating is set and the call is a no-op, which matches what happened before when the get failed.
With the same msleep() in place the patched kernel unlinks cleanly and the assoc is freed from the workqueue.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
Systems using the Linux NVMe target Fibre Channel transport (nvmet-fc) may be affected when a subsystem is unlinked from an FC port and its controllers are deleted. The provided information does not establish whether this configuration is enabled or used by default.
What event triggers the hang?
The issue occurs during controller deletion while the subsystem lock is held. If association cleanup completes before a reference is dropped, teardown can re-enter the subsystem lock recursively.
How can an administrator recognize the problem?
The affected operation can hang rather than only produce a lockdep warning. Kernel logs may report a possible recursive locking detection involving subsys->lock, with stack frames including nvmet_fc_delete_ctrl(), nvmet_fc_target_assoc_free(), and nvmet_ctrl_free().