CVE-2026-99714: nvme: Do not drop the cdev reference twice when cdev_device_add() fails
In the Linux kernel, the following vulnerability has been resolved:
nvme: Do not drop the cdev reference twice when cdevdeviceadd() fails
Since commit 9952f3882ecb ("nvme: fix cdev lifetime"), nvmeaddnscdev() and nvmeaddnsheadcdev() take a reference to the namespace (or namespace head) before calling nvmecdevadd(), to be dropped by the char device's release, nvmecdevrel(), and drop it themselves when nvmecdevadd() fails. But when cdevdeviceadd() fails, nvmecdevadd() has already put the device, and nvmecdevrel() has already dropped that reference: the caller drops it a second time.
With one allocation failure injected into cdevdeviceadd() for a namespace on an NVMe over loop controller, deleting the controller gives, with native multipath:
BUG: KASAN: slab-use-after-free in nvmeputnshead+0x21/0x140 Write of size 4 at addr ff1100000a4ea078 by task init/1 nvmeputnshead nvmeputns nvmeremovenamespaces nvmedodeletectrl nvmedeletectrlsync nvmesysfsdelete Freed by task 1: kfree nvmensremove nvmeremovenamespaces refcountt: underflow; use-after-free.
Take the reference in nvmecdevadd() instead, right before cdevdeviceadd(), and let the callers neither take nor drop it. Add nvmeisnscdev() for the check that nvmecdevrel() and nvmecdevadd() now share.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.192-2Fixed in 6.12.107-1Fixed in 6.12.117-1Fixed in 7.3.5-1
Event History
Frequently Asked Questions
Which systems are exposed to this issue?
Systems using the Linux kernel NVMe subsystem may be exposed when namespace character-device creation fails. The reported reproducer uses an NVMe over loop controller with native multipath enabled.
What condition is required to trigger the use-after-free?
The failure path requires cdev_device_add() to fail while adding an NVMe namespace or namespace-head character device. The provided reproducer injects a single allocation failure into cdev_device_add(), then deletes the controller.
Is this likely to occur during ordinary successful NVMe operation?
The described flaw is in the error-handling path for character-device registration, not the normal successful registration path. The data only demonstrates it after an injected allocation failure followed by controller deletion.
What symptoms indicate the issue may have been triggered?
Kernel diagnostics can include a refcount underflow and a KASAN slab-use-after-free report involving nvme_put_ns_head, nvme_put_ns, and NVMe namespace removal during controller deletion.