CVE-2026-143349: net/mlx5: macsec: free struct mlx5_fs_id after an RCU grace period
In the Linux kernel, the following vulnerability has been resolved:
net/mlx5: macsec: free struct mlx5fsid after an RCU grace period
macsecfsiddel() removes a struct mlx5fsid from its rhashtable with rhashtableremovefast() and then frees it with kfree() right away.
The TX (SCI) table is read locklessly from the transmit path: mlx5emacsechandletxskb() and mlx5emacsectxbuildeseg() call mlx5macsecfsgetfsidfromhashtable(), which does rhashtablelookup() under rcureadlock() and then reads mlx5fsid->id. A transmit that looked the entry up just before it was removed reads freed memory.
Before commit d4ece08f4b1d ("net/mlx5: Maintain fsid xarray per MACsec device inside macsec steering") the SCI table held struct mlx5emacsecsa directly, and mlx5emacsecdeltxsa() freed it with kfreercumightsleep(). That commit moved the table into macsecfs.c with the new struct mlx5fsid, but frees it with a plain kfree().
Add an rcuhead to struct mlx5fsid and free it with kfreercu().
The same issue was flagged by the Sashiko AI review as a pre-existing problem while reviewing the HW-GRO for PSP 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 6.12.120 - 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
Add an rcu_head to struct mlx5_fs_id and free it with kfree_rcu() so it remains valid through an RCU grace period.
Event History
Frequently Asked Questions
Which systems are exposed to this race condition?
Systems using the Linux kernel mlx5 MACsec transmit path are exposed when a MACsec SCI table entry can be removed while transmit processing is concurrently looking it up. The race involves lockless RCU-protected lookups of struct mlx5_fs_id entries.
How can I determine whether my kernel contains the vulnerable behavior?
Inspect macsec_fs_id_del() in the mlx5 MACsec code. The vulnerable implementation removes an entry with rhashtable_remove_fast() and immediately calls kfree(); the corrected implementation adds an rcu_head to struct mlx5_fs_id and frees the entry with kfree_rcu().
What should be changed to remediate the issue?
Use a kernel containing the referenced fixes, or apply the equivalent change to defer freeing struct mlx5_fs_id until after an RCU grace period with kfree_rcu(). This prevents transmit-path readers that obtained the entry before removal from dereferencing freed memory.