Skip to content
OpenAdvisories
Unscored CVE-2025-37786 EUVD-2025-13037GHSA-7mv8-qr93-j282

net: dsa: free routing table on probe failure

Published May 1, 2025 · Updated May 11, 2026 · Assigned by Linux

Vendor: Linux Product: Linux Package: kernel Package: linux Package: linux Package: linux-allwinner-5.19 Package: linux-aws Package: linux-aws-5.0 Package: linux-aws-5.11 Package: linux-aws-5.13 Package: linux-aws-5.15 Package: linux-aws-5.19 Package: linux-aws-5.3 Package: linux-aws-5.8 Package: linux-aws-6.2 Package: linux-aws-6.5 Package: linux-aws-6.8 Package: linux-aws-fips Package: linux-azure Package: linux-azure-5.11 Package: linux-azure-5.13 Package: linux-azure-5.15 Package: linux-azure-5.19 Package: linux-azure-5.3 Package: linux-azure-5.8 Package: linux-azure-6.11 Package: linux-azure-6.2 Package: linux-azure-6.5 Package: linux-azure-6.8 Package: linux-azure-edge Package: linux-azure-fde Package: linux-azure-fde-5.15 Package: linux-azure-fde-5.19 Package: linux-azure-fde-6.2 Package: linux-azure-fde-6.8 Package: linux-azure-fips Package: linux-azure-nvidia Package: linux-bluefield Package: linux-fips Package: linux-gcp Package: linux-gcp-5.11 Package: linux-gcp-5.13 Package: linux-gcp-5.15 Package: linux-gcp-5.19 Package: linux-gcp-5.3 Package: linux-gcp-5.8 Package: linux-gcp-6.11 Package: linux-gcp-6.2 Package: linux-gcp-6.5 Package: linux-gcp-6.8 Package: linux-gcp-fips Package: linux-gke Package: linux-gke-4.15 Package: linux-gke-5.15 Package: linux-gke-5.4 Package: linux-gkeop Package: linux-gkeop-5.15 Package: linux-gkeop-5.4 Package: linux-hwe Package: linux-hwe-5.11 Package: linux-hwe-5.13 Package: linux-hwe-5.15 Package: linux-hwe-5.19 Package: linux-hwe-5.8 Package: linux-hwe-6.11 Package: linux-hwe-6.2 Package: linux-hwe-6.5 Package: linux-hwe-6.8 Package: linux-hwe-edge Package: linux-ibm Package: linux-ibm-5.15 Package: linux-ibm-6.8 Package: linux-intel Package: linux-intel-5.13 Package: linux-intel-iot-realtime Package: linux-intel-iotg Package: linux-intel-iotg-5.15 Package: linux-kvm Package: linux-lowlatency Package: linux-lowlatency-hwe-5.15 Package: linux-lowlatency-hwe-5.19 Package: linux-lowlatency-hwe-6.11 Package: linux-lowlatency-hwe-6.2 Package: linux-lowlatency-hwe-6.5 Package: linux-lowlatency-hwe-6.8 Package: linux-nvidia Package: linux-nvidia-6.11 Package: linux-nvidia-6.2 Package: linux-nvidia-6.5 Package: linux-nvidia-6.8 Package: linux-nvidia-lowlatency Package: linux-nvidia-tegra Package: linux-nvidia-tegra-5.15 Package: linux-nvidia-tegra-igx Package: linux-oem Package: linux-oem-5.10 Package: linux-oem-5.13 Package: linux-oem-5.14 Package: linux-oem-5.17 Package: linux-oem-5.6 Package: linux-oem-6.0 Package: linux-oem-6.1 Package: linux-oem-6.11 Package: linux-oem-6.5 Package: linux-oem-6.8 Package: linux-oracle Package: linux-oracle-5.0 Package: linux-oracle-5.11 Package: linux-oracle-5.13 Package: linux-oracle-5.15 Package: linux-oracle-5.3 Package: linux-oracle-5.8 Package: linux-oracle-6.5 Package: linux-oracle-6.8 Package: linux-raspi Package: linux-raspi-realtime Package: linux-raspi2 Package: linux-realtime Package: linux-realtime-6.8 Package: linux-riscv Package: linux-riscv-5.11 Package: linux-riscv-5.15 Package: linux-riscv-5.19 Package: linux-riscv-5.8 Package: linux-riscv-6.5 Package: linux-riscv-6.8 Package: linux-starfive-5.19 Package: linux-starfive-6.2 Package: linux-starfive-6.5 Package: linux-vmware Package: linux-xilinx Package: linux-xilinx-zynqmp Platform: Linux Ecosystem: Azure Linux Ecosystem: Debian Ecosystem: Ubuntu

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 products

VendorProductAffectedFixed
Linux Linux 5.5 5.15.201

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 linux 6.12.25-1 —
Debian 13 linux 6.12.25-1 —
Debian 12 linux 6.1.164-1 DSA-6163-1
Debian 11 linux-6.1 6.1.164-1~deb11u1 DLA-4499-1
ReleasePackageFixed inAdvisory
Ubuntu Nvidia-BlueField 24.04 LTS linux-bluefield 6.8.0-1016.20 —
Ubuntu Nvidia-BlueField 22.04 LTS linux-bluefield 5.15.0-1096.98 —
Ubuntu 25.10 linux-azure-fde No fix yet —
Ubuntu 25.04 linux 6.14.0-22.22 USN-7594-1
Ubuntu 25.04 linux-aws +3 6.14.0-1007.7 USN-7594-3, USN-7594-2, USN-7594-1
Ubuntu 25.04 linux-gcp 6.14.0-1008.8 USN-7594-1
Ubuntu 25.04 linux-realtime 6.14.0-1004.4 USN-7594-1
Ubuntu 24.04 LTS linux 6.8.0-100.100 USN-8028-1
Ubuntu 24.04 LTS linux-aws +1 6.8.0-1046.49 USN-8028-5
Ubuntu 24.04 LTS linux-azure 6.8.0-1046.52 USN-8074-1
Ubuntu 24.04 LTS linux-azure-fde 6.8.0-1046.53 —
Ubuntu 24.04 LTS linux-azure-nvidia 6.8.0-1039.42 —
Ubuntu 24.04 LTS linux-gcp 6.8.0-1047.50 USN-8031-3
Ubuntu 24.04 LTS linux-gke 6.8.0-1043.48 USN-8031-3
Ubuntu 24.04 LTS linux-gkeop 6.8.0-1030.33 USN-8028-5
Ubuntu 24.04 LTS linux-ibm 6.8.0-1044.44 USN-8028-8
Ubuntu 24.04 LTS linux-intel +10 No fix yet —
Ubuntu 24.04 LTS linux-lowlatency 6.8.0-100.100.1 USN-8052-1
Ubuntu 24.04 LTS linux-nvidia-lowlatency 6.8.0-1046.49.1 USN-8028-7
Ubuntu 24.04 LTS linux-nvidia-tegra 6.8.0-1020.20 —
Ubuntu 24.04 LTS linux-oracle 6.8.0-1043.44 USN-8028-5
Ubuntu 24.04 LTS linux-raspi 6.8.0-1047.51 USN-8028-1
Ubuntu 24.04 LTS linux-xilinx 6.8.0-1023.24 USN-8052-2
Show 10 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS linux 5.15.0-186.196 USN-8575-1
Ubuntu 22.04 LTS linux-aws 5.15.0-1112.119 USN-8575-2
Ubuntu 22.04 LTS linux-aws-6.8 +1 6.8.0-1046.49~22.04.1 USN-8028-5
Ubuntu 22.04 LTS linux-azure +1 5.15.0-1117.126 USN-8610-1, USN-8575-3
Ubuntu 22.04 LTS linux-azure-6.8 6.8.0-1051.57~22.04.1 USN-8126-1
Ubuntu 22.04 LTS linux-azure-fde-6.8 6.8.0-1046.53~22.04.1 —
Ubuntu 22.04 LTS linux-gcp 5.15.0-1112.122 USN-8575-1
Ubuntu 22.04 LTS linux-gcp-6.8 6.8.0-1047.50~22.04.2 USN-8031-1
Ubuntu 22.04 LTS linux-gke 5.15.0-1108.114 USN-8575-1
Ubuntu 22.04 LTS linux-gkeop 5.15.0-1095.103 USN-8575-1
Ubuntu 22.04 LTS linux-hwe-6.8 +1 6.8.0-100.100~22.04.1 USN-8028-6
Ubuntu 22.04 LTS linux-ibm 5.15.0-1106.110 USN-8575-2
Ubuntu 22.04 LTS linux-ibm-6.8 6.8.0-1044.44~22.04.1 USN-8028-8
Ubuntu 22.04 LTS linux-intel-iotg 5.15.0-1107.113 USN-8620-4
Ubuntu 22.04 LTS linux-kvm 5.15.0-1104.109 USN-8575-1
Ubuntu 22.04 LTS linux-lowlatency 5.15.0-184.194 USN-8575-1
Ubuntu 22.04 LTS linux-lowlatency-hwe-6.8 6.8.0-100.100.1~22.04.1 USN-8028-6
Ubuntu 22.04 LTS linux-nvidia 5.15.0-1107.108 USN-8575-2
Ubuntu 22.04 LTS linux-nvidia-tegra 5.15.0-1064.66 USN-8576-2
Ubuntu 22.04 LTS linux-nvidia-tegra-igx 5.15.0-1053.53 USN-8576-2
Ubuntu 22.04 LTS linux-oracle 5.15.0-1109.115 USN-8575-3
Ubuntu 22.04 LTS linux-oracle-6.8 6.8.0-1043.44~22.04.1 USN-8028-5
Ubuntu 22.04 LTS linux-raspi 5.15.0-1106.109 USN-8668-2
Ubuntu 22.04 LTS linux-riscv +32 No fix yet —
Ubuntu 22.04 LTS linux-xilinx-zynqmp 5.15.0-1075.79 USN-8575-1
Ubuntu 20.04 LTS linux-gke +28 No fix yet —
Ubuntu 18.04 LTS linux-gcp +14 No fix yet —
Ubuntu 16.04 LTS linux-hwe-edge No fix yet —
Ubuntu Pro Realtime 24.04 LTS linux-raspi-realtime 6.8.0-2037.38 USN-8028-3
Ubuntu Pro Realtime 24.04 LTS linux-realtime 6.8.1-1041.42 USN-8028-3
Ubuntu Pro Realtime 22.04 LTS linux-intel-iot-realtime 5.15.0-1104.106 USN-8620-3
Ubuntu Pro Realtime 22.04 LTS linux-realtime 5.15.0-1111.120 USN-8575-1
Ubuntu Pro Realtime 22.04 LTS linux-realtime-6.8 6.8.1-1041.42~22.04.1 USN-8028-2
Ubuntu Pro FIPS-updates 24.04 LTS linux-aws-fips 6.8.0-1046.49+fips1 USN-8028-4
Ubuntu Pro FIPS-updates 24.04 LTS linux-azure-fips 6.8.0-1046.52+fips1 USN-8074-2
Ubuntu Pro FIPS-updates 24.04 LTS linux-fips 6.8.0-100.100+fips1 USN-8028-4
Ubuntu Pro FIPS-updates 24.04 LTS linux-gcp-fips 6.8.0-1047.50+fips1 USN-8031-2
Ubuntu Pro FIPS-updates 22.04 LTS linux-aws-fips 5.15.0-1112.119+fips1 USN-8575-2
Ubuntu Pro FIPS-updates 22.04 LTS linux-azure-fips 5.15.0-1117.126+fips1 USN-8620-2
Ubuntu Pro FIPS-updates 22.04 LTS linux-fips 5.15.0-186.196+fips1 USN-8575-2
Ubuntu Pro FIPS-updates 22.04 LTS linux-gcp-fips 5.15.0-1112.122+fips1 USN-8575-1
Ubuntu Pro FIPS-preview 22.04 LTS linux-fips +3 No fix yet —
Ubuntu Pro 20.04 LTS linux-aws-5.15 5.15.0-1112.119~20.04.1 USN-8575-2
Ubuntu Pro 20.04 LTS linux-azure-5.15 5.15.0-1117.126~20.04.1 USN-8620-1
Ubuntu Pro 20.04 LTS linux-azure-fde-5.15 5.15.0-1117.126~20.04.2 USN-8620-1
Ubuntu Pro 20.04 LTS linux-gcp-5.15 5.15.0-1112.122~20.04.1 USN-8668-1
Ubuntu Pro 20.04 LTS linux-hwe-5.15 5.15.0-186.196~20.04.1 USN-8575-1
Ubuntu Pro 20.04 LTS linux-ibm-5.15 +1 5.15.0-1106.110~20.04.1 —
Ubuntu Pro 20.04 LTS linux-intel-iotg-5.15 5.15.0-1107.113~20.04.1 USN-8620-3
Ubuntu Pro 20.04 LTS linux-lowlatency-hwe-5.15 5.15.0-184.194~20.04.1 USN-8575-1
Ubuntu Pro 20.04 LTS linux-nvidia-tegra-5.15 5.15.0-1064.66~20.04.1 USN-8576-1
Ubuntu Pro 20.04 LTS linux-oracle-5.15 5.15.0-1109.115~20.04.1 USN-8620-1
ReleasePackageFixed inAdvisory
SLES 15 SP7 kernel-64kb +6 6.4.0-150700.53.6.1 SUSE-SU-2025:02307-1
SLES 15 SP7 kernel-azure +2 6.4.0-150700.20.6.1 SUSE-SU-2025:02254-1
SLES 15 SP7 kernel-default-base 6.4.0-150700.53.6.1.150700.17.6.1 SUSE-SU-2025:02307-1
SLES 15 SP6 kernel-64kb +3 6.4.0-150600.23.60.4 SUSE-SU-2025:02538-1
SLES 15 SP6 kernel-azure +2 6.4.0-150600.8.43.1 SUSE-SU-2025:02249-1
SLES 15 SP6 kernel-coco +3 6.4.0-15061.28.coco15sp6.1 SUSE-SU-2025:02923-1
SLES 15 SP6 kernel-default 6.4.0-150600.23.60.5 SUSE-SU-2025:02538-1
SLES 15 SP6 kernel-default-base 6.4.0-150600.23.60.5.150600.12.26.4 SUSE-SU-2025:02538-1
SLES 15 SP6 kernel-docs +1 6.4.0-150600.23.60.3 SUSE-SU-2025:02538-1
Show 6 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLE Micro 6.1 kernel-default-base 6.4.0-31.1.21.9 SUSE-SU-2025:20475-1
SLE Micro 6.1 kernel-rt +1 6.4.0-34.1 SUSE-SU-2025:20483-1
SLE Micro 6.1 kernel-source +2 6.4.0-31.1 SUSE-SU-2025:20475-1
SLE Micro 6.0 kernel-default-base 6.4.0-31.1.21.9 SUSE-SU-2025:20493-1
SLE Micro 6.0 kernel-rt +1 6.4.0-34.1 SUSE-SU-2025:20498-1
SLE Micro 6.0 kernel-source +2 6.4.0-31.1 SUSE-SU-2025:20493-1
SLE Live Patching 15 SP7 kernel-default 6.4.0-150700.53.6.1 SUSE-SU-2025:02307-1
SLE Live Patching 15 SP7 kernel-livepatch-SLE15-SP7-RT_Update_2 1-150700.1.5.1 SUSE-SU-2025:02333-1
SLE Live Patching 15 SP7 kernel-livepatch-SLE15-SP7_Update_2 1-150700.15.3.1 SUSE-SU-2025:02307-1
SLE Live Patching 15 SP6 kernel-default 6.4.0-150600.23.60.5 SUSE-SU-2025:02538-1
SLE Live Patching 15 SP6 kernel-livepatch-SLE15-SP6-RT_Update_13 1-150600.1.5.1 SUSE-SU-2025:02335-1
SLE Live Patching 15 SP6 kernel-livepatch-SLE15-SP6_Update_13 1-150600.13.6.4 SUSE-SU-2025:02538-1
SUSE Real Time Module 15 SP7 kernel-rt +2 6.4.0-150700.7.8.1 SUSE-SU-2025:02333-1
SUSE Real Time Module 15 SP6 kernel-rt +3 6.4.0-150600.10.44.1 SUSE-SU-2025:02335-1
ReleasePackageFixed inAdvisory
openSUSE Leap 15.6 dtb-aarch64 +2 6.4.0-150600.23.60.3 SUSE-SU-2025:02538-1
openSUSE Leap 15.6 kernel-64kb +5 6.4.0-150600.23.60.4 SUSE-SU-2025:02538-1
openSUSE Leap 15.6 kernel-azure +2 6.4.0-150600.8.43.1 SUSE-SU-2025:02249-1
openSUSE Leap 15.6 kernel-default 6.4.0-150600.23.60.5 SUSE-SU-2025:02538-1
openSUSE Leap 15.6 kernel-default-base 6.4.0-150600.23.60.5.150600.12.26.4 SUSE-SU-2025:02538-1
openSUSE Leap 15.6 kernel-obs-qa 6.4.0-150600.23.60.2 SUSE-SU-2025:02538-1
openSUSE Leap 15.6 kernel-rt +3 6.4.0-150600.10.44.1 SUSE-SU-2025:02335-1

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2023 bpftool +14 6.12.25-32.101.amzn2023 ALAS2023-2025-995
Amazon Linux 2023 kernel-livepatch-6.12.25-32.101 1.0-0.amzn2023 ALAS2023-2025-995

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 2 (CBL-Mariner) kernel No fix yet —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 9 kernel-uek +34 6.12.0-101.33.4.3.el10uek ELSA-2025-20530, ELSA-2025-20480

Advisories 48

References