# CVE-2025-37786: net: dsa: free routing table on probe failure

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.30% (percentile 15, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-05-01T13:07:20.980Z
- **Modified:** 2026-06-17T09:15:26.267Z

## Who should check

- Anyone running Linux \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 51df5513cca6349d0bea01bab95cd96cf869976e; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 6c20894d21600ca1e8549086dfbb986e277bf8a6; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< fb12b460ec46c9efad98de6d9ba349691db51dc7; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< a038f5f15af455dfe35bc68549e02b950978700a; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 8bf108d7161ffc6880ad13a0cc109de3cf631727
- Anyone running Linux 5.5

## Description

In the Linux kernel, the following vulnerability has been resolved:

net: dsa: free routing table on probe failure

If complete = true in dsa\_tree\_setup(), it means that we are the last
switch of the tree which is successfully probing, and we should be
setting up all switches from our probe path.

After "complete" becomes true, dsa\_tree\_setup\_cpu\_ports() or any
subsequent function may fail. If that happens, the entire tree setup is
in limbo: the first N-1 switches have successfully finished probing
(doing nothing but having allocated persistent memory in the tree's
dst-\>ports, and maybe dst-\>rtable), and switch N failed to probe, ending
the tree setup process before anything is tangible from the user's PoV.

If switch N fails to probe, its memory (ports) will be freed and removed
from dst-\>ports. However, the dst-\>rtable elements pointing to its ports,
as created by dsa\_link\_touch(), will remain there, and will lead to
use-after-free if dereferenced.

If dsa\_tree\_setup\_switches() returns -EPROBE\_DEFER, which is entirely
possible because that is where ds-\>ops-\>setup() is, we get a kasan
report like this:

==================================================================
BUG: KASAN: slab-use-after-free in mv88e6xxx\_setup\_upstream\_port+0x240/0x568
Read of size 8 at addr ffff000004f56020 by task kworker/u8:3/42

Call trace:
 \_\_asan\_report\_load8\_noabort+0x20/0x30
 mv88e6xxx\_setup\_upstream\_port+0x240/0x568
 mv88e6xxx\_setup+0xebc/0x1eb0
 dsa\_register\_switch+0x1af4/0x2ae0
 mv88e6xxx\_register\_switch+0x1b8/0x2a8
 mv88e6xxx\_probe+0xc4c/0xf60
 mdio\_probe+0x78/0xb8
 really\_probe+0x2b8/0x5a8
 \_\_driver\_probe\_device+0x164/0x298
 driver\_probe\_device+0x78/0x258
 \_\_device\_attach\_driver+0x274/0x350

Allocated by task 42:
 \_\_kasan\_kmalloc+0x84/0xa0
 \_\_kmalloc\_cache\_noprof+0x298/0x490
 dsa\_switch\_touch\_ports+0x174/0x3d8
 dsa\_register\_switch+0x800/0x2ae0
 mv88e6xxx\_register\_switch+0x1b8/0x2a8
 mv88e6xxx\_probe+0xc4c/0xf60
 mdio\_probe+0x78/0xb8
 really\_probe+0x2b8/0x5a8
 \_\_driver\_probe\_device+0x164/0x298
 driver\_probe\_device+0x78/0x258
 \_\_device\_attach\_driver+0x274/0x350

Freed by task 42:
 \_\_kasan\_slab\_free+0x48/0x68
 kfree+0x138/0x418
 dsa\_register\_switch+0x2694/0x2ae0
 mv88e6xxx\_register\_switch+0x1b8/0x2a8
 mv88e6xxx\_probe+0xc4c/0xf60
 mdio\_probe+0x78/0xb8
 really\_probe+0x2b8/0x5a8
 \_\_driver\_probe\_device+0x164/0x298
 driver\_probe\_device+0x78/0x258
 \_\_device\_attach\_driver+0x274/0x350

The simplest way to fix the bug is to delete the routing table in its
entirety. dsa\_tree\_setup\_routing\_table() has no problem in regenerating
it even if we deleted links between ports other than those of switch N,
because dsa\_link\_touch() first checks whether the port pair already
exists in dst-\>rtable, allocating if not.

The deletion of the routing table in its entirety already exists in
dsa\_tree\_teardown(), so refactor that into a function that can also be
called from the tree setup error path.

In my analysis of the commit to blame, it is the one which added
dsa\_link elements to dst-\>rtable. Prior to that, each switch had its own
ds-\>rtable which is freed when the switch fails to probe. But the tree
is potentially persistent memory.

## Affected and fixed versions

- Linux: \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 51df5513cca6349d0bea01bab95cd96cf869976e; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 6c20894d21600ca1e8549086dfbb986e277bf8a6; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< fb12b460ec46c9efad98de6d9ba349691db51dc7; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< a038f5f15af455dfe35bc68549e02b950978700a; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 8bf108d7161ffc6880ad13a0cc109de3cf631727 (cvelist)
- Linux: 5.5 (cvelist)

## Mitigation

- Upgrade Linux to 8bf108d7161ffc6880ad13a0cc109de3cf631727 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-37786. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-37786.md
Affected: Linux >= c5f51765a1f60b701840544faf3ca63204b8dc3c, < 51df5513cca6349d0bea01bab95cd96cf869976e; >= c5f51765a1f60b701840544faf3ca63204b8dc3c, < 6c20894d21600ca1e8549086dfbb986e277bf8a6; >= c5f51765a1f60b701840544faf3ca63204b8dc3c, < fb12b460ec46c9efad98de6d9ba349691db51dc7; >= c5f51765a1f60b701840544…
Fixed in: Linux 51df5513cca6349d0bea01bab95cd96cf869976e, Linux 6c20894d21600ca1e8549086dfbb986e277bf8a6, Linux 5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de, Linux 8bf108d7161ffc6880ad13a0cc109de3cf631727

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-37786 being exploited?

There is no confirmed exploitation: CVE-2025-37786 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.30% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-37786?

High: CVSS 7.8 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-37786?

Linux \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 51df5513cca6349d0bea01bab95cd96cf869976e; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 6c20894d21600ca1e8549086dfbb986e277bf8a6; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< fb12b460ec46c9efad98de6d9ba349691db51dc7; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< a038f5f15af455dfe35bc68549e02b950978700a; \>= c5f51765a1f60b701840544faf3ca63204b8dc3c, \< 8bf108d7161ffc6880ad13a0cc109de3cf631727; Linux 5.5.

### Is there a fix for CVE-2025-37786?

Yes. Fixed in Linux 51df5513cca6349d0bea01bab95cd96cf869976e, Linux 6c20894d21600ca1e8549086dfbb986e277bf8a6, Linux 5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de, Linux 8bf108d7161ffc6880ad13a0cc109de3cf631727. Upgrade Linux to 8bf108d7161ffc6880ad13a0cc109de3cf631727 or later.

### How do I check if I'm affected by CVE-2025-37786?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/51df5513cca6349d0bea01bab95cd96cf869976e>
- patch: <https://git.kernel.org/stable/c/6c20894d21600ca1e8549086dfbb986e277bf8a6>
- patch: <https://git.kernel.org/stable/c/fb12b460ec46c9efad98de6d9ba349691db51dc7>
- patch: <https://git.kernel.org/stable/c/5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de>
- patch: <https://git.kernel.org/stable/c/a038f5f15af455dfe35bc68549e02b950978700a>
- patch: <https://git.kernel.org/stable/c/8bf108d7161ffc6880ad13a0cc109de3cf631727>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-37786>

HTML: <https://flawdb.com/CVE-2025-37786> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-37786>
