CVE-2026-139582: RDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVER_FAILURE
In the Linux kernel, the following vulnerability has been resolved:
RDMA/nldev: Fix NULL deref in dumps of objects abandoned by DRIVERFAILURE
fillrescqentry() dereferences cq->uobject->uevent.uobject.context->res.id unconditionally for user resources.
This is normally safe by ordering: destroyhw() removes the resource from the restrack before uverbsdestroyuobject() clears ->context, and the XAZEROENTRY marker set by rdmarestrackbegindel() hides the entry from concurrent netlink dumps.
The ordering breaks when a driver keeps failing to destroy an object during ucontext teardown. uverbsdestroyufilehw() then falls back to uverbscleanupufile(RDMAREMOVEDRIVERFAILURE), which abandons the object in place: the HW object and its restrack entry are intentionally leaked, while the uobject bookkeeping is torn down and ->context is explicitly set to NULL by uverbsdestroyuobject(). rdmarestrackdel() is never reached, so the orphaned entry stays in the device restrack with a valid kref, reachable by any subsequent netlink dump.
Observed on 6.1.52 with MLNXOFED 24.10, after an mlx5 FW failure left a process unable to tear down its CQ (destroycq FW command failing during FD close):
WARNING: ... uverbsdestroyufilehw+0xe3/0x100 BUG: kernel NULL pointer dereference, address: 0000000000000058 RIP: 0010:fillrescqentry+0x15e/0x180 [ibcore] resgetcommondumpit+0x304/0x530 [ibcore] nldevresgetcqdumpit+0x1a/0x20 [ibcore]
The faulting chain maps to the source (CR2 = 0x58): cq->uobject (struct ibcq +0x08, res at +0x98) uobject->context (struct ibuobject +0x10, NULL after abandon) context->res.id (struct ibucontext +0x58)
The recent restrack rework (8d186210677c and its series) moved the restrack deletion to the start of the destroy flow and thus fences concurrent dumps from an object being destroyed, but it does not cover this case: when destroy fails, rdmarestrackabortdel() restores the entry, and the RDMAREMOVEDRIVERFAILURE sweep still never removes it from the restrack.
From the fallback until the device is unregistered, any "rdma res show cq" deterministically takes the NULL pointer dereference; this is a long-lived state, NOT A RACE. The dump path holds neither the restrack lock (dropped before the fill callback runs) nor ufile->hwdestroyrwsem, and rdmarestrackget() only guarantees that the res memory stays alive, not that ->context is still valid.
Fix the dump side: check the uobject context directly instead of the rdmaiskernelres() marker. A non-NULL uobject already implies a user resource, so kernel resources keep being skipped, and the additional ->context check skips the RESCTXN attribute for orphaned entries instead of crashing the dump. The orphaned resource itself remains visible in "rdma res show" (cqn/cqe/usecnt/pid), which is what an operator needs after the accompanying uverbs WARN to diagnose the driver destroy failure.
fillrespdentry() has the same pattern (pd->uobject->context->res.id) and is fixed the same way; a PD can even reach the fallback without its own driver callback failing, e.g. uverbsfreepd() returns -EBUSY while another object that failed to destroy still holds the PD usecnt.
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.10.275 - 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
Event History
Frequently Asked Questions
What conditions are required for this issue to occur?
An RDMA user object must fail to be destroyed during ucontext teardown because the driver repeatedly fails its hardware destroy operation. Cleanup then abandons the hardware object and its resource-tracking entry while clearing the associated uobject context.
What can trigger the NULL dereference after an object has been abandoned?
Any subsequent netlink dump that reaches the orphaned resource-tracking entry can trigger it. The entry remains reachable because it was not removed from resource tracking before its uobject context was cleared.
How can an environment be investigated for exposure?
Look for RDMA object teardown failures, particularly failed CQ destruction caused by driver or firmware failures, followed by RDMA netlink resource dumps. The reported observation involved an mlx5 firmware failure that prevented a process from tearing down its CQ.