# CVE-2025-40251: devlink: rate: Unset parent pointer in devl\_rate\_nodes\_destroy

> 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, CNA) `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.23% (percentile 9, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2025-12-04T16:08:13.710Z
- **Modified:** 2026-10-19T19:10:00.130Z

## Who should check

- Anyone running Linux \>= d7555984507822458b32a6405881038241d140be, \< 90e51e20bcec9bff5b2421ce1bd95704764655f5; \>= d7555984507822458b32a6405881038241d140be, \< 715d9cda646a8a38ea8b2bb5afb679a7464055e2; \>= d7555984507822458b32a6405881038241d140be, \< c70df6c17d389cc743f0eb30160e2d6bc6910db8; \>= d7555984507822458b32a6405881038241d140be, \< 542f45486f1ce2d2dde75bd85aca0389ef7046c3; \>= d7555984507822458b32a6405881038241d140be, \< f94c1a114ac209977bdf5ca841b98424295ab1f0
- Anyone running Linux 5.14

## Description

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

devlink: rate: Unset parent pointer in devl\_rate\_nodes\_destroy

The function devl\_rate\_nodes\_destroy is documented to "Unset parent for
all rate objects". However, it was only calling the driver-specific
\`rate\_leaf\_parent\_set\` or \`rate\_node\_parent\_set\` ops and decrementing
the parent's refcount, without actually setting the
\`devlink\_rate-\>parent\` pointer to NULL.

This leaves a dangling pointer in the \`devlink\_rate\` struct, which cause
refcount error in netdevsim\[1\] and mlx5\[2\]. In addition, this is
inconsistent with the behavior of \`devlink\_nl\_rate\_parent\_node\_set\`,
where the parent pointer is correctly cleared.

This patch fixes the issue by explicitly setting \`devlink\_rate-\>parent\`
to NULL after notifying the driver, thus fulfilling the function's
documented behavior for all rate objects.

\[1\]
repro steps:
echo 1 \> /sys/bus/netdevsim/new\_device
devlink dev eswitch set netdevsim/netdevsim1 mode switchdev
echo 1 \> /sys/bus/netdevsim/devices/netdevsim1/sriov\_numvfs
devlink port function rate add netdevsim/netdevsim1/test\_node
devlink port function rate set netdevsim/netdevsim1/128 parent test\_node
echo 1 \> /sys/bus/netdevsim/del\_device

dmesg:
refcount\_t: decrement hit 0; leaking memory.
WARNING: CPU: 8 PID: 1530 at lib/refcount.c:31 refcount\_warn\_saturate+0x42/0xe0
CPU: 8 UID: 0 PID: 1530 Comm: bash Not tainted 6.18.0-rc4+ \#1 NONE
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
RIP: 0010:refcount\_warn\_saturate+0x42/0xe0
Call Trace:
 \<TASK\>
 devl\_rate\_leaf\_destroy+0x8d/0x90
 \_\_nsim\_dev\_port\_del+0x6c/0x70 \[netdevsim\]
 nsim\_dev\_reload\_destroy+0x11c/0x140 \[netdevsim\]
 nsim\_drv\_remove+0x2b/0xb0 \[netdevsim\]
 device\_release\_driver\_internal+0x194/0x1f0
 bus\_remove\_device+0xc6/0x130
 device\_del+0x159/0x3c0
 device\_unregister+0x1a/0x60
 del\_device\_store+0x111/0x170 \[netdevsim\]
 kernfs\_fop\_write\_iter+0x12e/0x1e0
 vfs\_write+0x215/0x3d0
 ksys\_write+0x5f/0xd0
 do\_syscall\_64+0x55/0x10f0
 entry\_SYSCALL\_64\_after\_hwframe+0x4b/0x53

\[2\]
devlink dev eswitch set pci/0000:08:00.0 mode switchdev
devlink port add pci/0000:08:00.0 flavour pcisf pfnum 0 sfnum 1000
devlink port function rate add pci/0000:08:00.0/group1
devlink port function rate set pci/0000:08:00.0/32768 parent group1
modprobe -r mlx5\_ib mlx5\_fwctl mlx5\_core

dmesg:
refcount\_t: decrement hit 0; leaking memory.
WARNING: CPU: 7 PID: 16151 at lib/refcount.c:31 refcount\_warn\_saturate+0x42/0xe0
CPU: 7 UID: 0 PID: 16151 Comm: bash Not tainted 6.17.0-rc7\_for\_upstream\_min\_debug\_2025\_10\_02\_12\_44 \#1 NONE
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
RIP: 0010:refcount\_warn\_saturate+0x42/0xe0
Call Trace:
 \<TASK\>
 devl\_rate\_leaf\_destroy+0x8d/0x90
 mlx5\_esw\_offloads\_devlink\_port\_unregister+0x33/0x60 \[mlx5\_core\]
 mlx5\_esw\_offloads\_unload\_rep+0x3f/0x50 \[mlx5\_core\]
 mlx5\_eswitch\_unload\_sf\_vport+0x40/0x90 \[mlx5\_core\]
 mlx5\_sf\_esw\_event+0xc4/0x120 \[mlx5\_core\]
 notifier\_call\_chain+0x33/0xa0
 blocking\_notifier\_call\_chain+0x3b/0x50
 mlx5\_eswitch\_disable\_locked+0x50/0x110 \[mlx5\_core\]
 mlx5\_eswitch\_disable+0x63/0x90 \[mlx5\_core\]
 mlx5\_unload+0x1d/0x170 \[mlx5\_core\]
 mlx5\_uninit\_one+0xa2/0x130 \[mlx5\_core\]
 remove\_one+0x78/0xd0 \[mlx5\_core\]
 pci\_device\_remove+0x39/0xa0
 device\_release\_driver\_internal+0x194/0x1f0
 unbind\_store+0x99/0xa0
 kernfs\_fop\_write\_iter+0x12e/0x1e0
 vfs\_write+0x215/0x3d0
 ksys\_write+0x5f/0xd0
 do\_syscall\_64+0x53/0x1f0
 entry\_SYSCALL\_64\_after\_hwframe+0x4b/0x53

## Affected and fixed versions

- Linux: \>= d7555984507822458b32a6405881038241d140be, \< 90e51e20bcec9bff5b2421ce1bd95704764655f5; \>= d7555984507822458b32a6405881038241d140be, \< 715d9cda646a8a38ea8b2bb5afb679a7464055e2; \>= d7555984507822458b32a6405881038241d140be, \< c70df6c17d389cc743f0eb30160e2d6bc6910db8; \>= d7555984507822458b32a6405881038241d140be, \< 542f45486f1ce2d2dde75bd85aca0389ef7046c3; \>= d7555984507822458b32a6405881038241d140be, \< f94c1a114ac209977bdf5ca841b98424295ab1f0 (cvelist)
- Linux: 5.14 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-40251.md
Affected: Linux >= d7555984507822458b32a6405881038241d140be, < 90e51e20bcec9bff5b2421ce1bd95704764655f5; >= d7555984507822458b32a6405881038241d140be, < 715d9cda646a8a38ea8b2bb5afb679a7464055e2; >= d7555984507822458b32a6405881038241d140be, < c70df6c17d389cc743f0eb30160e2d6bc6910db8; >= d7555984507822458b32a64…
Fixed in: Linux 90e51e20bcec9bff5b2421ce1bd95704764655f5, Linux 715d9cda646a8a38ea8b2bb5afb679a7464055e2, Linux 542f45486f1ce2d2dde75bd85aca0389ef7046c3

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-40251 being exploited?

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

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

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

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

Linux \>= d7555984507822458b32a6405881038241d140be, \< 90e51e20bcec9bff5b2421ce1bd95704764655f5; \>= d7555984507822458b32a6405881038241d140be, \< 715d9cda646a8a38ea8b2bb5afb679a7464055e2; \>= d7555984507822458b32a6405881038241d140be, \< c70df6c17d389cc743f0eb30160e2d6bc6910db8; \>= d7555984507822458b32a6405881038241d140be, \< 542f45486f1ce2d2dde75bd85aca0389ef7046c3; \>= d7555984507822458b32a6405881038241d140be, \< f94c1a114ac209977bdf5ca841b98424295ab1f0; Linux 5.14.

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

Yes. Fixed in Linux 90e51e20bcec9bff5b2421ce1bd95704764655f5, Linux 715d9cda646a8a38ea8b2bb5afb679a7464055e2, Linux 542f45486f1ce2d2dde75bd85aca0389ef7046c3. No fix listed yet: follow the vendor advisory.

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

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/90e51e20bcec9bff5b2421ce1bd95704764655f5>
- patch: <https://git.kernel.org/stable/c/715d9cda646a8a38ea8b2bb5afb679a7464055e2>
- patch: <https://git.kernel.org/stable/c/c70df6c17d389cc743f0eb30160e2d6bc6910db8>
- patch: <https://git.kernel.org/stable/c/542f45486f1ce2d2dde75bd85aca0389ef7046c3>
- patch: <https://git.kernel.org/stable/c/f94c1a114ac209977bdf5ca841b98424295ab1f0>
- other: <https://cert-portal.siemens.com/productcert/html/ssa-253495.html>

## 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-40251>

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