{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2025-37786","id":"CVE-2025-37786","title":"net: dsa: free routing table on probe failure","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: dsa: free routing table on probe failure\n\nIf complete = true in dsa_tree_setup(), it means that we are the last\nswitch of the tree which is successfully probing, and we should be\nsetting up all switches from our probe path.\n\nAfter \"complete\" becomes true, dsa_tree_setup_cpu_ports() or any\nsubsequent function may fail. If tha","descriptionLong":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: dsa: free routing table on probe failure\n\nIf complete = true in dsa_tree_setup(), it means that we are the last\nswitch of the tree which is successfully probing, and we should be\nsetting up all switches from our probe path.\n\nAfter \"complete\" becomes true, dsa_tree_setup_cpu_ports() or any\nsubsequent function may fail. If that happens, the entire tree setup is\nin limbo: the first N-1 switches have successfully finished probing\n(doing nothing but having allocated persistent memory in the tree's\ndst->ports, and maybe dst->rtable), and switch N failed to probe, ending\nthe tree setup process before anything is tangible from the user's PoV.\n\nIf switch N fails to probe, its memory (ports) will be freed and removed\nfrom dst->ports. However, the dst->rtable elements pointing to its ports,\nas created by dsa_link_touch(), will remain there, and will lead to\nuse-after-free if dereferenced.\n\nIf dsa_tree_setup_switches() returns -EPROBE_DEFER, which is entirely\npossible because that is where ds->ops->setup() is, we get a kasan\nreport like this:\n\n==================================================================\nBUG: KASAN: slab-use-after-free in mv88e6xxx_setup_upstream_port+0x240/0x568\nRead of size 8 at addr ffff000004f56020 by task kworker/u8:3/42\n\nCall trace:\n __asan_report_load8_noabort+0x20/0x30\n mv88e6xxx_setup_upstream_port+0x240/0x568\n mv88e6xxx_setup+0xebc/0x1eb0\n dsa_register_switch+0x1af4/0x2ae0\n mv88e6xxx_register_switch+0x1b8/0x2a8\n mv88e6xxx_probe+0xc4c/0xf60\n mdio_probe+0x78/0xb8\n really_probe+0x2b8/0x5a8\n __driver_probe_device+0x164/0x298\n driver_probe_device+0x78/0x258\n __device_attach_driver+0x274/0x350\n\nAllocated by task 42:\n __kasan_kmalloc+0x84/0xa0\n __kmalloc_cache_noprof+0x298/0x490\n dsa_switch_touch_ports+0x174/0x3d8\n dsa_register_switch+0x800/0x2ae0\n mv88e6xxx_register_switch+0x1b8/0x2a8\n mv88e6xxx_probe+0xc4c/0xf60\n mdio_probe+0x78/0xb8\n really_probe+0x2b8/0x5a8\n __driver_probe_device+0x164/0x298\n driver_probe_device+0x78/0x258\n __device_attach_driver+0x274/0x350\n\nFreed by task 42:\n __kasan_slab_free+0x48/0x68\n kfree+0x138/0x418\n dsa_register_switch+0x2694/0x2ae0\n mv88e6xxx_register_switch+0x1b8/0x2a8\n mv88e6xxx_probe+0xc4c/0xf60\n mdio_probe+0x78/0xb8\n really_probe+0x2b8/0x5a8\n __driver_probe_device+0x164/0x298\n driver_probe_device+0x78/0x258\n __device_attach_driver+0x274/0x350\n\nThe simplest way to fix the bug is to delete the routing table in its\nentirety. dsa_tree_setup_routing_table() has no problem in regenerating\nit even if we deleted links between ports other than those of switch N,\nbecause dsa_link_touch() first checks whether the port pair already\nexists in dst->rtable, allocating if not.\n\nThe deletion of the routing table in its entirety already exists in\ndsa_tree_teardown(), so refactor that into a function that can also be\ncalled from the tree setup error path.\n\nIn my analysis of the commit to blame, it is the one which added\ndsa_link elements to dst->rtable. Prior to that, each switch had its own\nds->rtable which is freed when the switch fails to probe. But the tree\nis potentially persistent memory.","published":"2025-05-01T13:07:20.980Z","updated":"2026-10-28T02:30:27.641651384Z","reserved":"2025-04-16T04:51:23.940Z","status":"Analyzed","rejected":false,"assigner":"Linux","metric":{"version":"3.1","score":7.8,"vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","rating":"high","source":"NVD"},"metrics":[{"version":"3.1","score":7.8,"vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","rating":"high","source":"NVD"}],"rating":"high","products":["Linux"],"affectedProducts":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c5f51765a1f60b701840544faf3ca63204b8dc3c","lessThan":"51df5513cca6349d0bea01bab95cd96cf869976e","status":"affected","versionType":"git"},{"version":"c5f51765a1f60b701840544faf3ca63204b8dc3c","lessThan":"6c20894d21600ca1e8549086dfbb986e277bf8a6","status":"affected","versionType":"git"},{"version":"c5f51765a1f60b701840544faf3ca63204b8dc3c","lessThan":"fb12b460ec46c9efad98de6d9ba349691db51dc7","status":"affected","versionType":"git"},{"version":"c5f51765a1f60b701840544faf3ca63204b8dc3c","lessThan":"5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de","status":"affected","versionType":"git"},{"version":"c5f51765a1f60b701840544faf3ca63204b8dc3c","lessThan":"a038f5f15af455dfe35bc68549e02b950978700a","status":"affected","versionType":"git"},{"version":"c5f51765a1f60b701840544faf3ca63204b8dc3c","lessThan":"8bf108d7161ffc6880ad13a0cc109de3cf631727","status":"affected","versionType":"git"}],"platforms":[]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.5","status":"affected"},{"version":"0","lessThan":"5.5","status":"unaffected","versionType":"semver"},{"version":"5.15.201","lessThanOrEqual":"5.15.*","status":"unaffected","versionType":"semver"},{"version":"6.1.164","lessThanOrEqual":"6.1.*","status":"unaffected","versionType":"semver"},{"version":"6.6.88","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.12.25","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.14.4","lessThanOrEqual":"6.14.*","status":"unaffected","versionType":"semver"},{"version":"6.15","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}],"platforms":[]}],"packages":[],"cwes":["CWE-416"],"aliases":[],"references":[{"url":"https://git.kernel.org/stable/c/51df5513cca6349d0bea01bab95cd96cf869976e","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/6c20894d21600ca1e8549086dfbb986e277bf8a6","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/fb12b460ec46c9efad98de6d9ba349691db51dc7","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/5c8066fbdb9653c6e9a224bdcd8f9c91a484f0de","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/a038f5f15af455dfe35bc68549e02b950978700a","tags":["Patch","web"]},{"url":"https://git.kernel.org/stable/c/8bf108d7161ffc6880ad13a0cc109de3cf631727","tags":["Patch","web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/37xxx/CVE-2025-37786.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-37786","tags":["advisory"]},{"url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","tags":["package"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":null,"epss":0.00194,"epssPercentile":0.09165,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2025-37786","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-37786","ok":true,"note":"Analyzed"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2025-37786","ok":true,"note":"0 packages"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2025-37786","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}