# CVE-2025-22126: md: fix mddev uaf while iterating all\_mddevs list

> 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.31% (percentile 16, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-04-16T14:13:09.399Z
- **Modified:** 2026-06-17T08:45:12.203Z

## Who should check

- Anyone running Linux \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< ca9f84de76723b358dfc0606668efdca54afc2e5; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< d69a23d8e925f8052d657652a6875ec2712c7e33; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< e2a9f73ee408a460f4c9dfe03b4741d6b11652b8; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< 5462544ccbad3fc938a71b01fa5bd3a0dc2b750a; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< 8542870237c3a48ff049b6c5df5f50c8728284fa
- Anyone running Linux 6.0

## Description

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

md: fix mddev uaf while iterating all\_mddevs list

While iterating all\_mddevs list from md\_notify\_reboot() and md\_exit(),
list\_for\_each\_entry\_safe is used, and this can race with deletint the
next mddev, causing UAF:

t1:
spin\_lock
//list\_for\_each\_entry\_safe(mddev, n, ...)
 mddev\_get(mddev1)
 // assume mddev2 is the next entry
 spin\_unlock
            t2:
            //remove mddev2
            ...
            mddev\_free
            spin\_lock
            list\_del
            spin\_unlock
            kfree(mddev2)
 mddev\_put(mddev1)
 spin\_lock
 //continue dereference mddev2-\>all\_mddevs

The old helper for\_each\_mddev() actually grab the reference of mddev2
while holding the lock, to prevent from being freed. This problem can be
fixed the same way, however, the code will be complex.

Hence switch to use list\_for\_each\_entry, in this case mddev\_put() can free
the mddev1 and it's not safe as well. Refer to md\_seq\_show(), also factor
out a helper mddev\_put\_locked() to fix this problem.

## Affected and fixed versions

- Linux: \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< ca9f84de76723b358dfc0606668efdca54afc2e5; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< d69a23d8e925f8052d657652a6875ec2712c7e33; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< e2a9f73ee408a460f4c9dfe03b4741d6b11652b8; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< 5462544ccbad3fc938a71b01fa5bd3a0dc2b750a; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< 8542870237c3a48ff049b6c5df5f50c8728284fa (cvelist)
- Linux: 6.0 (cvelist)

## Mitigation

- Upgrade Linux to 8542870237c3a48ff049b6c5df5f50c8728284fa 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-22126. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-22126.md
Affected: Linux >= f26514342255855f4ca3c0a92cb1cdea01c33004, < ca9f84de76723b358dfc0606668efdca54afc2e5; >= f26514342255855f4ca3c0a92cb1cdea01c33004, < d69a23d8e925f8052d657652a6875ec2712c7e33; >= f26514342255855f4ca3c0a92cb1cdea01c33004, < e2a9f73ee408a460f4c9dfe03b4741d6b11652b8; >= f26514342255855f4ca3c0a…
Fixed in: Linux 5462544ccbad3fc938a71b01fa5bd3a0dc2b750a, Linux 8542870237c3a48ff049b6c5df5f50c8728284fa

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

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

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

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

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

Linux \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< ca9f84de76723b358dfc0606668efdca54afc2e5; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< d69a23d8e925f8052d657652a6875ec2712c7e33; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< e2a9f73ee408a460f4c9dfe03b4741d6b11652b8; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< 5462544ccbad3fc938a71b01fa5bd3a0dc2b750a; \>= f26514342255855f4ca3c0a92cb1cdea01c33004, \< 8542870237c3a48ff049b6c5df5f50c8728284fa; Linux 6.0.

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

Yes. Fixed in Linux 5462544ccbad3fc938a71b01fa5bd3a0dc2b750a, Linux 8542870237c3a48ff049b6c5df5f50c8728284fa. Upgrade Linux to 8542870237c3a48ff049b6c5df5f50c8728284fa or later.

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

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/ca9f84de76723b358dfc0606668efdca54afc2e5>
- patch: <https://git.kernel.org/stable/c/d69a23d8e925f8052d657652a6875ec2712c7e33>
- patch: <https://git.kernel.org/stable/c/e2a9f73ee408a460f4c9dfe03b4741d6b11652b8>
- patch: <https://git.kernel.org/stable/c/5462544ccbad3fc938a71b01fa5bd3a0dc2b750a>
- patch: <https://git.kernel.org/stable/c/8542870237c3a48ff049b6c5df5f50c8728284fa>
- other: <https://lists.debian.org/debian-lts-announce/2025/05/msg00045.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-22126>

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