CVE-2025-22126: md: fix mddev uaf while iterating all_mddevs list

Published Apr 16, 2025
·
Updated

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

md: fix mddev uaf while iterating allmddevs list

While iterating allmddevs list from mdnotifyreboot() and mdexit(), listforeachentrysafe is used, and this can race with deletint the next mddev, causing UAF:

t1: spinlock //listforeachentrysafe(mddev, n, ...) mddevget(mddev1) // assume mddev2 is the next entry spinunlock t2: //remove mddev2 ... mddevfree spinlock listdel spinunlock kfree(mddev2) mddevput(mddev1) spinlock //continue dereference mddev2->allmddevs

The old helper foreachmddev() 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 listforeachentry, in this case mddevput() can free the mddev1 and it's not safe as well. Refer to mdseqshow(), also factor out a helper mddevputlocked() to fix this problem.

Affected Software

8 affected componentsFixes available
Linux Kernel
Linux Linux kernel>=6.0<6.1.135
Linux Linux kernel>=6.2<6.6.88
Linux Linux kernel>=6.7<6.12.25
Linux Linux kernel>=6.13<6.14.2
Microsoft azl3 kernel 6.6.85.1-4
Microsoft azl3 kernel 6.6.92.2-1
debian/linux
6.1.176-16.1.190-16.12.107-16.12.115-27.2.12-17.2.15-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.115-2Fixed in 7.2.12-1Fixed in 7.2.15-1

Event History

Apr 16, 2025
CVE Published
via MITRE·02:13 PM
Data Sourced
via MITRE·02:13 PM
Description
Data Sourced
via Red Hat·03:03 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 11, 2025
Data Sourced
via Microsoft·07:00 AM
DescriptionSeverityWeaknessAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2025-22126?

CVE-2025-22126 has a severity rating that indicates a potential for privilege escalation due to use-after-free vulnerabilities in the Linux kernel.

2

How do I fix CVE-2025-22126?

To fix CVE-2025-22126, ensure that your Linux kernel is updated to a version that includes the necessary patches provided for this vulnerability.

3

Which systems are affected by CVE-2025-22126?

CVE-2025-22126 affects systems running vulnerable versions of the Linux kernel.

4

What can exploit CVE-2025-22126?

CVE-2025-22126 can potentially be exploited by local attackers who have the ability to run code on the affected systems.

5

Is CVE-2025-22126 included in any security advisories?

Yes, CVE-2025-22126 is included in various security advisories detailing the vulnerability and remediation steps.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203