CVE-2025-21810 driver core: class: Fix wild pointer dereferences in API class_dev_iter_next()

High 7.8 Published Updated

A wild pointer dereference in the Linux kernel's class device iterator can cause a system crash, requiring a kernel patch to fix.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2025-21810?

CVE-2025-21810 is a high-severity vulnerability in Linux kernel, published on 27 Feb 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

driver core: class: Fix wild pointer dereferences in API class_dev_iter_next()

There are a potential wild pointer dereferences issue regarding APIs class_dev_iter_(init|next|exit)(), as explained by below typical usage:

// All members of @iter are wild pointers. struct class_dev_iter iter;

// class_dev_iter_init(@iter, @class, ...) checks parameter @class for // potential class_to_subsys() error, and it returns void type and does // not initialize its output parameter @iter, so caller can not detect // the error and continues to invoke class_dev_iter_next(@iter) even if // @iter still contains wild pointers. class_dev_iter_init(&iter, ...);

// Dereference these wild pointers in @iter here once suffer the error. while (dev = class_dev_iter_next(&iter)) { ... };

// Also dereference these wild pointers here. class_dev_iter_exit(&iter);

Actually, all callers of these APIs have such usage pattern in kernel tree. Fix by: - Initialize output parameter @iter by memset() in class_dev_iter_init() and give callers prompt by pr_crit() for the error. - Check if @iter is valid in class_dev_iter_next().

Weakness: CWE-476

Which versions are affected by CVE-2025-21810?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-21810?

Apply the vendor's patch.

Is CVE-2025-21810 being exploited?

There is no known exploitation of CVE-2025-21810 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2025-21810, DEBIAN-CVE-2025-21810, GHSA-p7wm-885p-3rmg, ROOT-OS-UBUNTU-2404-CVE-2025-21810, UBUNTU-CVE-2025-21810.

Is CVE-2025-21810 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free