Description
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->mode_lock semaphore:
mlx5_eswitch_safe_aux_devs_remove()
mlx5_esw_hold()
down_read_trylock(&esw->mode_lock) (*)
mlx5_core_reps_aux_devs_remove()
...
mlx5e_vport_uplink_rep_unload()
unregister_netdev()
xfrm_dev_unregister()
xfrm_dev_policy_flush()
xfrm_policy_kill()
xfrm_dev_policy_delete()
mlx5e_xfrm_del_policy()
mlx5e_accel_ipsec_fs_del_pol()
rx_ft_put_policy()
rx_put()
mlx5_eswitch_unblock_mode()
down_write(&esw->mode_lock) (BOOM)
Another deadlock with IPsec states:
mlx5_eswitch_safe_aux_devs_remove()
mlx5_esw_hold()
down_read_trylock(&esw->mode_lock) (*)
mlx5_core_reps_aux_devs_remove()
...
mlx5e_vport_uplink_rep_unload()
unregister_netdev()
xfrm_dev_unregister()
xfrm_dev_state_flush()
xfrm_dev_state_free()
mlx5e_xfrm_free_state()
mlx5e_accel_ipsec_fs_del_rule()
rx_ft_put()
rx_put()
rx_destroy()
mlx5_eswitch_unblock_encap()
down_write(&esw->mode_lock) (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 mlx5_esw_lock_wait(), which waits for an operation in progress to
finish. They all hold devl_lock, so the only operation they can find in
progress is an uplink unbind, which doesn't need devl_lock.
Setting the esw mode keeps using mlx5_esw_try_lock(), which also rejects
the change while eswitch users exist and bails out with -EBUSY.
mlx5_eswitch_safe_aux_devs_remove() now also waits for an operation in
progress with the same mlx5_esw_lock_wait() before initiating one,
dropping mode_lock and then removing representors.
The deadlocks are avoided.
Finishing an operation in progress now requires mlx5_esw_unlock() to
wake up any waiters instead of plain up_write(&mode_lock).
As a side effect, the timeout in mlx5_eswitch_safe_aux_devs_remove() 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.
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->mode_lock semaphore:
mlx5_eswitch_safe_aux_devs_remove()
mlx5_esw_hold()
down_read_trylock(&esw->mode_lock) (*)
mlx5_core_reps_aux_devs_remove()
...
mlx5e_vport_uplink_rep_unload()
unregister_netdev()
xfrm_dev_unregister()
xfrm_dev_policy_flush()
xfrm_policy_kill()
xfrm_dev_policy_delete()
mlx5e_xfrm_del_policy()
mlx5e_accel_ipsec_fs_del_pol()
rx_ft_put_policy()
rx_put()
mlx5_eswitch_unblock_mode()
down_write(&esw->mode_lock) (BOOM)
Another deadlock with IPsec states:
mlx5_eswitch_safe_aux_devs_remove()
mlx5_esw_hold()
down_read_trylock(&esw->mode_lock) (*)
mlx5_core_reps_aux_devs_remove()
...
mlx5e_vport_uplink_rep_unload()
unregister_netdev()
xfrm_dev_unregister()
xfrm_dev_state_flush()
xfrm_dev_state_free()
mlx5e_xfrm_free_state()
mlx5e_accel_ipsec_fs_del_rule()
rx_ft_put()
rx_put()
rx_destroy()
mlx5_eswitch_unblock_encap()
down_write(&esw->mode_lock) (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 mlx5_esw_lock_wait(), which waits for an operation in progress to
finish. They all hold devl_lock, so the only operation they can find in
progress is an uplink unbind, which doesn't need devl_lock.
Setting the esw mode keeps using mlx5_esw_try_lock(), which also rejects
the change while eswitch users exist and bails out with -EBUSY.
mlx5_eswitch_safe_aux_devs_remove() now also waits for an operation in
progress with the same mlx5_esw_lock_wait() before initiating one,
dropping mode_lock and then removing representors.
The deadlocks are avoided.
Finishing an operation in progress now requires mlx5_esw_unlock() to
wake up any waiters instead of plain up_write(&mode_lock).
As a side effect, the timeout in mlx5_eswitch_safe_aux_devs_remove() 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.
Published:
2026-12-03
Score:
n/a
EPSS:
n/a
KEV:
No
Analysis and contextual insights are available on OpenCVE Cloud.
Remediation
No vendor fix or workaround currently provided.
Additional remediation guidance may be available on OpenCVE Cloud.
Tracking
Sign in to view the affected projects.
Advisories
No advisories yet.
References
History
Thu, 03 Dec 2026 09:45:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Description | 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->mode_lock semaphore: mlx5_eswitch_safe_aux_devs_remove() mlx5_esw_hold() down_read_trylock(&esw->mode_lock) (*) mlx5_core_reps_aux_devs_remove() ... mlx5e_vport_uplink_rep_unload() unregister_netdev() xfrm_dev_unregister() xfrm_dev_policy_flush() xfrm_policy_kill() xfrm_dev_policy_delete() mlx5e_xfrm_del_policy() mlx5e_accel_ipsec_fs_del_pol() rx_ft_put_policy() rx_put() mlx5_eswitch_unblock_mode() down_write(&esw->mode_lock) (BOOM) Another deadlock with IPsec states: mlx5_eswitch_safe_aux_devs_remove() mlx5_esw_hold() down_read_trylock(&esw->mode_lock) (*) mlx5_core_reps_aux_devs_remove() ... mlx5e_vport_uplink_rep_unload() unregister_netdev() xfrm_dev_unregister() xfrm_dev_state_flush() xfrm_dev_state_free() mlx5e_xfrm_free_state() mlx5e_accel_ipsec_fs_del_rule() rx_ft_put() rx_put() rx_destroy() mlx5_eswitch_unblock_encap() down_write(&esw->mode_lock) (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 mlx5_esw_lock_wait(), which waits for an operation in progress to finish. They all hold devl_lock, so the only operation they can find in progress is an uplink unbind, which doesn't need devl_lock. Setting the esw mode keeps using mlx5_esw_try_lock(), which also rejects the change while eswitch users exist and bails out with -EBUSY. mlx5_eswitch_safe_aux_devs_remove() now also waits for an operation in progress with the same mlx5_esw_lock_wait() before initiating one, dropping mode_lock and then removing representors. The deadlocks are avoided. Finishing an operation in progress now requires mlx5_esw_unlock() to wake up any waiters instead of plain up_write(&mode_lock). As a side effect, the timeout in mlx5_eswitch_safe_aux_devs_remove() 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. | |
| Title | net/mlx5e: Fix E-Switch races in uplink unbind | |
| First Time appeared |
Linux
Linux linux Kernel |
|
| CPEs | cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | |
| Vendors & Products |
Linux
Linux linux Kernel |
|
| References |
|
Status: PUBLISHED
Assigner: Linux
Published:
Updated: 2026-12-03T09:20:31.417Z
Reserved: 2026-12-03T03:10:28.360Z
Link: CVE-2026-143209
No data.
Status : Received
Published: 2026-12-03T10:17:58.717
Modified: 2026-12-03T10:17:58.717
Link: CVE-2026-143209
No data.
OpenCVE Enrichment
No data.
Weaknesses
No weakness.