CVE-2026-139352: IB/mlx4: Avoid requeueing executing CM timeout work
In the Linux kernel, the following vulnerability has been resolved:
IB/mlx4: Avoid requeueing executing CM timeout work
id->scheduleddelete is set by scheduledelayed() itself. It is used in two cases after the RTU timeout support was added:
A new idmapentry is created, and a 60-second RTU timeout is scheduled. DREQ or REJ is received for an existing entry, and the normal 30-second teardown timeout is scheduled or adjusted.
The following race is possible when the RTU timeout expires while a DREQ or REJ is handled:
CPU 0: timeout work CPU 1: DREQ/REJ handler -------------------- ----------------------- RTU timer expires timeout callback starts waits for idmaplock takes idmaplock
calls scheduledelayed() calls moddelayedwork()
drops idmaplock
takes idmaplock removes mapping frees idmapentry
requeued timeout runs accesses freed idmapentry
moddelayedwork() may requeue the work after the timeout callback has started. The original timeout callback then frees the idmapentry, leaving the requeued work with a dangling delayedwork pointer.
When a timeout is already scheduled, first cancel its pending work. A successful cancellation means the callback has not started and the timeout can safely be scheduled again. If cancellation fails, the callback is executing and will free the entry after idmaplock is released; do not requeue it.
canceldelayedwork() is deliberately used instead of canceldelayedworksync(), because the timeout callback may be waiting for idmaplock, which is held by the caller.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
When a timeout is already scheduled, call cancel_delayed_work() before rescheduling it. Reschedule only if cancellation succeeds; if it fails, do not requeue the work because the timeout callback may be executing and will free the id_map_entry.
Event History
Frequently Asked Questions
What event combination is required to trigger the race?
An RTU timeout must expire while a DREQ or REJ is being handled for the same id_map_entry. The timeout callback can begin execution while the handler adjusts or schedules delayed teardown work.
What is the consequence if the race occurs?
mod_delayed_work() can requeue timeout work after its callback has started. The original callback may then free the id_map_entry, leaving the requeued work with a dangling delayed_work pointer that can access freed memory.
What change addresses the issue?
When timeout work is already scheduled, pending work is canceled before it is rescheduled or adjusted. A successful cancellation confirms that the callback has not started.