CVE-2026-139591: RDMA/mlx5: Restore mr->pi_mr after temporary stack-local assignment
In the Linux kernel, the following vulnerability has been resolved:
RDMA/mlx5: Restore mr->pimr after temporary stack-local assignment
In handleregmrintegrity, when mr->pimr is NULL (physical-address optimization path), the code points mr->pimr at a stack-local papimr so setpiumrwr can read it during this call. The pointer is never restored, so after the function returns mr->pimr dangles at a freed stack frame. A second IBWRREGMRINTEGRITY posted on the same MR without remapping reads the stale pointer and dereferences it.
Save the original pimr (captured at function entry) and restore it on the out path.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In handle_reg_mr_integrity, save the original pi_mr at function entry and restore it on the out path after the temporary stack-local assignment.
Event History
Frequently Asked Questions
What systems and workloads are exposed to this issue?
The issue affects Linux kernel RDMA/mlx5 use of memory regions with integrity registration. It is specifically reachable on the physical-address optimization path when mr->pi_mr is NULL.
What operation is required to trigger the stale-pointer dereference?
A first IB_WR_REG_MR_INTEGRITY operation must cause mr->pi_mr to be temporarily assigned to the stack-local pa_pi_mr. A second IB_WR_REG_MR_INTEGRITY posted on the same memory region without remapping can then read and dereference the dangling pointer.
How can I determine whether a system has encountered the vulnerable state?
Look for workloads that post repeated IB_WR_REG_MR_INTEGRITY requests against the same memory region without remapping, particularly when using the physical-address optimization path. The affected state is created after the first registration leaves mr->pi_mr pointing to a stack-local object.
What does the available fix change?
The fix saves the original mr->pi_mr value at function entry and restores it on the function's out path. This prevents the memory region from retaining a pointer to the expired stack-local pa_pi_mr object.