CVE-2024-42224 net: dsa: mv88e6xxx: Correct check for empty list

High 7.0 Published Updated

A null pointer dereference in the Marvell DSA driver can cause a kernel crash when handling empty MDIO bus lists.

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-2024-42224?

CVE-2024-42224 is a high-severity vulnerability in Linux kernel, published on 30 Jul 2024. 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:

net: dsa: mv88e6xxx: Correct check for empty list

Since commit a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses") mv88e6xxx_default_mdio_bus() has checked that the return value of list_first_entry() is non-NULL.

This appears to be intended to guard against the list chip->mdios being empty. However, it is not the correct check as the implementation of list_first_entry is not designed to return NULL for empty lists.

Instead, use list_first_entry_or_null() which does return NULL if the list is empty.

Flagged by Smatch. Compile tested only.

Weakness: CWE-754

Which versions are affected by CVE-2024-42224?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-42224?

Apply the vendor's patch.

Is CVE-2024-42224 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as AZL-47337, AZL-47379, BELL-CVE-2024-42224, DEBIAN-CVE-2024-42224, GHSA-3q3x-839r-4xrh, UBUNTU-CVE-2024-42224.

Is CVE-2024-42224 in your software?

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

Check your SBOMs for free