CVE-2026-99960: nvmet: take subsys->lock while force-reconnecting in nvmet_subsys_attr_qid_max_store()
In the Linux kernel, the following vulnerability has been resolved:
nvmet: take subsys->lock while force-reconnecting in nvmetsubsysattrqidmaxstore()
nvmetsubsysattrqidmaxstore() sets subsys->maxqid and then walks subsys->ctrls to force every controller to reconnect, but it holds only nvmetconfigsem (for write). subsys->ctrls is protected by subsys->lock: nvmetallocctrl() adds an entry under subsys->lock, and nvmetctrlfree() removes it under subsys->lock with listdel() + kfree() (not kfreercu). The free path takes no nvmetconfigsem, so the two locks are independent.
A controller teardown (host disconnect, keep-alive timeout or fatal error -> nvmetsqdestroy() -> nvmetctrlput() -> nvmetctrlfree()) can therefore listdel() an entry while qidmaxstore() is iterating the list, corrupting the walk.
KASAN, concurrent "echo 128 > .../subsystems/<nqn>/attrqidmax" racing nvme-loop controllers connecting and disconnecting, panics in seconds:
BUG: KASAN: null-ptr-deref in nvmetsubsysattrqidmaxstore+0x10d/0x1b0 Read of size 8 at addr 0000000000000090 Call Trace: nvmetsubsysattrqidmaxstore+0x10d/0x1b0 configfswriteiter+0x1a7/0x250 vfswrite+0x5df/0x940 ksyswrite+0xfd/0x1e0
(also seen as a general-protection fault dereferencing a LISTPOISON pointer at the same instruction.)
Take subsys->lock around the listforeachentry() loop, matching every other subsys->ctrls accessor. ->deletectrl() only queues asynchronous controller teardown, so it does not re-enter subsys->lock under the loop.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In nvmet_subsys_attr_qid_max_store(), take subsys->lock around the subsys->ctrls list_for_each_entry() loop while force-reconnecting controllers.