CVE-2025-22126

md: fix mddev uaf while iterating all_mddevs list

No CVSS score yet EPSS 0.20%

Published 16 Apr 2025 Updated 11 May 2026 CNA: Linux

Check your servers for CVE-2025-22126

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-22126 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Exploitation

EPSS 0.20%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 10.8% of all scored CVEs. Scores of 1 Dec 2026.

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from f26514342255855f4ca3c0a92cb1cdea01c33004, before ca9f84de76723b358dfc0606668efdca54afc2e5
affected from f26514342255855f4ca3c0a92cb1cdea01c33004, before d69a23d8e925f8052d657652a6875ec2712c7e33
affected from f26514342255855f4ca3c0a92cb1cdea01c33004, before e2a9f73ee408a460f4c9dfe03b4741d6b11652b8
affected from f26514342255855f4ca3c0a92cb1cdea01c33004, before 5462544ccbad3fc938a71b01fa5bd3a0dc2b750a
affected from f26514342255855f4ca3c0a92cb1cdea01c33004, before 8542870237c3a48ff049b6c5df5f50c8728284fa
Other versions: unaffected
Linux
affected 6.0
unaffected before 6.0
unaffected from 6.1.135 up to and including 6.1.*
unaffected from 6.6.88 up to and including 6.6.*
unaffected from 6.12.25 up to and including 6.12.*
unaffected from 6.14.2 up to and including 6.14.*
unaffected 6.15 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-22126 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-22126

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2025-22126
trivy image --scanners vuln IMAGE | grep CVE-2025-22126

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2025-22126 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.