CVE-2025-40297: net: bridge: fix use-after-free due to MST port state bypass
In the Linux kernel, the following vulnerability has been resolved:
net: bridge: fix use-after-free due to MST port state bypass
syzbot reported[1] a use-after-free when deleting an expired fdb. It is due to a race condition between learning still happening and a port being deleted, after all its fdbs have been flushed. The port's state has been toggled to disabled so no learning should happen at that time, but if we have MST enabled, it will bypass the port's state, that together with VLAN filtering disabled can lead to fdb learning at a time when it shouldn't happen while the port is being deleted. VLAN filtering must be disabled because we flush the port VLANs when it's being deleted which will stop learning. This fix adds a check for the port's vlan group which is initialized to NULL when the port is getting deleted, that avoids the port state bypass. When MST is enabled there would be a minimal new overhead in the fast-path because the port's vlan group pointer is cache-hot.
[1] https://syzkaller.appspot.com/bug?extid=dd280197f0f7ab3917be
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Disable VLAN filtering (net/bridge VLAN filtering must be disabled) to prevent fdb learning during port deletion.
Linux kernel net: bridge VLAN filtering = disabled - Compensating control
Enable MST (MST enabled bypasses the port's state) so that the bridge port's vlan group pointer bypass can avoid the use-after-free during port deletion/race with learning.
Event History
Frequently Asked Questions
What is the severity of CVE-2025-40297?
CVE-2025-40297 has a medium severity rating due to the potential for a use-after-free vulnerability that can lead to system instability.
How do I fix CVE-2025-40297?
To fix CVE-2025-40297, update your Linux kernel to the patched version that addresses the use-after-free issue.
What systems are affected by CVE-2025-40297?
CVE-2025-40297 affects versions of the Linux kernel that utilize the bridge networking feature.
What type of vulnerability is CVE-2025-40297?
CVE-2025-40297 is classified as a use-after-free vulnerability in the Linux kernel.
What causes CVE-2025-40297?
CVE-2025-40297 is caused by a race condition that occurs when a port is deleted while learning still happens.