{"id":"CVE-2026-143209","summary":"net/mlx5e: Fix E-Switch races in uplink unbind","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/mlx5e: Fix E-Switch races in uplink unbind\n\nUnbinding the uplink Ethernet auxiliary driver in switchdev mode with\noffloaded IPsec policies deadlocks on the esw-\u003emode_lock semaphore:\nmlx5_eswitch_safe_aux_devs_remove()\n  mlx5_esw_hold()\n    down_read_trylock(&esw-\u003emode_lock)                 (*)\n  mlx5_core_reps_aux_devs_remove()\n    ...\n    mlx5e_vport_uplink_rep_unload()\n      unregister_netdev()\n        xfrm_dev_unregister()\n          xfrm_dev_policy_flush()\n            xfrm_policy_kill()\n              xfrm_dev_policy_delete()\n                mlx5e_xfrm_del_policy()\n                  mlx5e_accel_ipsec_fs_del_pol()\n                    rx_ft_put_policy()\n                      rx_put()\n                        mlx5_eswitch_unblock_mode()\n                          down_write(&esw-\u003emode_lock)  (BOOM)\n\nAnother deadlock with IPsec states:\nmlx5_eswitch_safe_aux_devs_remove()\n  mlx5_esw_hold()\n    down_read_trylock(&esw-\u003emode_lock)                (*)\n  mlx5_core_reps_aux_devs_remove()\n    ...\n    mlx5e_vport_uplink_rep_unload()\n      unregister_netdev()\n        xfrm_dev_unregister()\n          xfrm_dev_state_flush()\n            xfrm_dev_state_free()\n              mlx5e_xfrm_free_state()\n                mlx5e_accel_ipsec_fs_del_rule()\n                  rx_ft_put()\n                    rx_put()\n                      rx_destroy()\n                        mlx5_eswitch_unblock_encap()\n                          down_write(&esw-\u003emode_lock)  (BOOM)\n\nTo fix these, first refactor initiators of eswitch operations so they no\nlonger step on each other's toes.\n\nThe active/inactive toggle and setting the inline/encap mode now use the\nnew mlx5_esw_lock_wait(), which waits for an operation in progress to\nfinish. They all hold devl_lock, so the only operation they can find in\nprogress is an uplink unbind, which doesn't need devl_lock.\nSetting the esw mode keeps using mlx5_esw_try_lock(), which also rejects\nthe change while eswitch users exist and bails out with -EBUSY.\n\nmlx5_eswitch_safe_aux_devs_remove() now also waits for an operation in\nprogress with the same mlx5_esw_lock_wait() before initiating one,\ndropping mode_lock and then removing representors.\nThe deadlocks are avoided.\n\nFinishing an operation in progress now requires mlx5_esw_unlock() to\nwake up any waiters instead of plain up_write(&mode_lock).\n\nAs a side effect, the timeout in mlx5_eswitch_safe_aux_devs_remove() is\ngone, which fixes another scary corner case, of representor devs not\nbeing removed on timeout but leaked instead. The timeout hid the SD\ndeadlock fixed in the previous patch. Now that that's gone, no reason\nfor the timeout to stay.\n\nThis was found by internal testing and reproduced on HW.\nIt was independently found by Sashiko during analysis of another patch\nin this series.","modified":"2026-12-03T11:01:48.869354472Z","published":"2026-12-03T09:20:31.417Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143209.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/5eaf9931c8af41b1f0de6dc0589efa698784157c"},{"type":"WEB","url":"https://git.kernel.org/stable/c/a73906f469f85a1147d5b5d31ca57e2d8443327f"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/143xxx/CVE-2026-143209.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-143209"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"2ae8c7edea87f54609bda30963a099cd3c64b0bb"},{"fixed":"a73906f469f85a1147d5b5d31ca57e2d8443327f"},{"fixed":"5eaf9931c8af41b1f0de6dc0589efa698784157c"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143209.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-143209.json"}}],"schema_version":"1.9.2"}