CVE-2026-139158: nvmet: protect nvmet_ports_list with nvmet_config_sem
In the Linux kernel, the following vulnerability has been resolved:
nvmet: protect nvmetportslist with nvmetconfigsem
Readers of nvmetportslist (e.g. nvmetsubsysdiscchanged()) hold nvmetconfigsem and assert it via lockdep. The writers -- nvmetportsmake() and nvmetportrelease() -- do not take the lock; they rely on the parent directory's VFS inode lock for serialization, which is an implementation detail of configfs and not a guaranteed contract. Align the writers with the lock the readers already require.
Also move listadd() in nvmetportsmake() to after the port is fully initialized: the old position published the port on the global list before INITLISTHEAD(&port->subsystems), so a concurrent reader could traverse uninitialized list heads.
flushworkqueue() in nvmetportrelease() stays outside the semaphore to avoid a lock dependency on nvmetwq.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.119 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.65 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.6-1 - Compensating control
In nvmet_ports_make() and nvmet_port_release(), protect updates to nvmet_ports_list with nvmet_config_sem to match readers. In nvmet_ports_make(), move list_add() until after the port is fully initialized, including INIT_LIST_HEAD(&port->subsystems). Keep flush_workqueue() in nvmet_port_release() outside the semaphore.
Event History
Frequently Asked Questions
Which systems are exposed to this race condition?
Systems using the kernel NVMe target subsystem and performing concurrent operations on NVMe target ports are relevant. The race involves creation or release of ports while other code reads the global nvmet_ports_list, including discovery-change handling.
What unsafe conditions did the fix address?
Port creation could publish a port to the global list before its subsystems list head was initialized, allowing a concurrent reader to traverse uninitialized list state. Port creation and release also lacked the nvmet_config_sem lock that readers require, relying instead on configfs VFS inode-lock behavior.