CVE-2026-139665: RDMA/core: Fix swapped list_add_tail() arguments in ib_add_sub_device()
In the Linux kernel, the following vulnerability has been resolved:
RDMA/core: Fix swapped listaddtail() arguments in ibaddsubdevice()
ibaddsubdevice() links a new sub-device into its parent's sub-device list with:
listaddtail(&parent->subdevlisthead, &sub->subdevlist);
listaddtail(new, head) expects the node to insert as the first argument and the list head as the second, so the call above does the opposite of what was intended: it treats the parent's list head as the new node and the sub-device's node as the list head.
Because iballocdevice() initialises subdevlist to a self-referencing empty head, the misplaced insertion does not crash, but it corrupts the parent->subdevlisthead list. After adding two or more sub-devices, only the last one is reachable through the parent's head, and ibdelsubdeviceandput()'s listdel() on &sub->subdevlist rewrites the head pointers, potentially severing earlier sub-devices from the chain. During parent teardown, the reverse iteration over subdevlisthead then skips the orphaned sub-devices, so their delsubdev() callbacks are never invoked and ibdeviceput() on the parent is never paired, leaking both the HW sub-devices and a refcount.
Swap the arguments to match the documented intent: insert the sub-device node into the parent's list head.
Affected Software
Event History
Frequently Asked Questions
Which systems are exposed to the faulty cleanup behavior?
Systems that create two or more RDMA sub-devices under the same parent can be affected. With only one sub-device, the described orphaning behavior does not occur.
What happens when an affected parent device is torn down?
Earlier sub-devices can be skipped during reverse iteration because they are no longer reachable from the parent list. Their del_sub_dev() callbacks are not invoked, and the corresponding ib_device_put() operations on the parent are not performed, causing resource leaks.
How can operators recognize the issue in runtime behavior?
A parent with multiple sub-devices may expose only the most recently added sub-device through its sub-device list. Removing sub-devices can further sever earlier entries, and parent teardown may leave orphaned sub-devices without their cleanup callbacks being called.