CVE-2026-143208: net/mlx5e: Fix ipsec core device access during profile changes
In the Linux kernel, the following vulnerability has been resolved:
net/mlx5e: Fix ipsec core device access during profile changes
Devlink E-Switch mode changes replace the netdev profile without unregistering the netdev. XFRM state and policy creation can therefore run while mlx5eprivcleanup() clears priv with memset() or mlx5eprivinit() initializes it again. Accesses to priv->mdev can observe NULL or a torn pointer, and repeated loads may return different values.
Read priv->mdev once in each add callback and use the saved pointer throughout the callback, including error unwinding. The core device survives the in-place profile change, so a saved non-NULL pointer remains valid even if priv is cleared in the meantime.
A NULL priv->mdev means a profile change is in progress, which only happens during an eswitch mode change. Return -EBUSY in that case, as mlx5eswitchblockmode() does for the same mode change. -EOPNOTSUPP would make xfrmdevstateadd() silently fall back to software for a crypto offload SA for its whole lifetime.
Use WRITEONCE() when initializing priv->mdev and when clearing it before memset(). This makes the transition to NULL atomic; the subsequent bulk clear only writes zero bytes over an already NULL pointer. Annotate the READONCE() snapshots with datarace() to allow that harmless overlap with the unmarked memset() without suppressing checks for the rest of priv.
This fixes the core-device pointer accesses. Protecting the IPsec context itself during state and policy creation is handled separately.
This was found by Sashiko, during review of the next patches in the series. No attempt was made at reproducing this race, the chances seem vanishingly small.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.66 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.7 - Compensating control
In the mlx5e IPsec callbacks, read priv->mdev once and use the saved pointer throughout the callback, including error unwinding; return -EBUSY when it is NULL. Use WRITE_ONCE() when initializing and clearing priv->mdev, and annotate READ_ONCE() snapshots with data_race().
Event History
Frequently Asked Questions
Which systems are exposed to this race condition?
The race is tied to Devlink E-Switch mode changes on mlx5e devices and concurrent XFRM/IPsec state or policy creation. A NULL priv->mdev occurs only while an E-Switch mode change is in progress.
What should happen if an XFRM/IPsec offload operation arrives during an E-Switch mode change?
It should fail with -EBUSY while the profile transition is in progress. Returning -EOPNOTSUPP is not appropriate because it can cause a crypto-offload security association to silently use software processing for its entire lifetime.
What can operators do if they cannot immediately deploy the fix?
Avoid performing Devlink E-Switch mode changes while creating XFRM states or policies for IPsec offload. The affected concurrency is between profile replacement during the mode change and those XFRM operations.