CVE-2026-143209: net/mlx5e: Fix E-Switch races in uplink unbind
In the Linux kernel, the following vulnerability has been resolved:
net/mlx5e: Fix E-Switch races in uplink unbind
Unbinding the uplink Ethernet auxiliary driver in switchdev mode with offloaded IPsec policies deadlocks on the esw->modelock semaphore: mlx5eswitchsafeauxdevsremove() mlx5eswhold() downreadtrylock(&esw->modelock) () mlx5corerepsauxdevsremove() ... mlx5evportuplinkrepunload() unregisternetdev() xfrmdevunregister() xfrmdevpolicyflush() xfrmpolicykill() xfrmdevpolicydelete() mlx5exfrmdelpolicy() mlx5eaccelipsecfsdelpol() rxftputpolicy() rxput() mlx5eswitchunblockmode() downwrite(&esw->modelock) (BOOM)
Another deadlock with IPsec states: mlx5eswitchsafeauxdevsremove() mlx5eswhold() downreadtrylock(&esw->modelock) () mlx5corerepsauxdevsremove() ... mlx5evportuplinkrepunload() unregisternetdev() xfrmdevunregister() xfrmdevstateflush() xfrmdevstatefree() mlx5exfrmfreestate() mlx5eaccelipsecfsdelrule() rxftput() rxput() rxdestroy() mlx5eswitchunblockencap() downwrite(&esw->modelock) (BOOM)
To fix these, first refactor initiators of eswitch operations so they no longer step on each other's toes.
The active/inactive toggle and setting the inline/encap mode now use the new mlx5eswlockwait(), which waits for an operation in progress to finish. They all hold devllock, so the only operation they can find in progress is an uplink unbind, which doesn't need devllock. Setting the esw mode keeps using mlx5eswtrylock(), which also rejects the change while eswitch users exist and bails out with -EBUSY.
mlx5eswitchsafeauxdevsremove() now also waits for an operation in progress with the same mlx5eswlockwait() before initiating one, dropping modelock and then removing representors. The deadlocks are avoided.
Finishing an operation in progress now requires mlx5eswunlock() to wake up any waiters instead of plain upwrite(&modelock).
As a side effect, the timeout in mlx5eswitchsafeauxdevsremove() is gone, which fixes another scary corner case, of representor devs not being removed on timeout but leaked instead. The timeout hid the SD deadlock fixed in the previous patch. Now that that's gone, no reason for the timeout to stay.
This was found by internal testing and reproduced on HW. It was independently found by Sashiko during analysis of another patch in this series.
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.7
Event History
Frequently Asked Questions
Which systems should be prioritized for remediation?
Prioritize Linux systems using the mlx5e Ethernet driver in switchdev mode where the uplink Ethernet auxiliary driver may be unbound while IPsec policies or IPsec states are offloaded.
What operational condition triggers the failure?
The deadlock occurs during uplink auxiliary-driver removal or unbinding. Cleanup of offloaded IPsec policies or states can attempt to take the E-Switch mode lock for writing while the removal path holds it for reading.