CVE-2021-47556 ethtool: ioctl: fix potential NULL deref in ethtool_set_coalesce()

Medium 5.5 Published Updated

A local attacker can cause a kernel crash by triggering a NULL pointer dereference in ethtool coalesce settings on specific drivers.

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-2021-47556?

CVE-2021-47556 is a medium-severity vulnerability in Linux kernel, published on 24 May 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:

ethtool: ioctl: fix potential NULL deref in ethtool_set_coalesce()

ethtool_set_coalesce() now uses both the .get_coalesce() and .set_coalesce() callbacks. But the check for their availability is buggy, so changing the coalesce settings on a device where the driver provides only _one_ of the callbacks results in a NULL pointer dereference instead of an -EOPNOTSUPP.

Fix the condition so that the availability of both callbacks is ensured. This also matches the netlink code.

Note that reproducing this requires some effort - it only affects the legacy ioctl path, and needs a specific combination of driver options: - have .get_coalesce() and .coalesce_supported but no .set_coalesce(), or - have .set_coalesce() but no .get_coalesce(). Here eg. ethtool doesn't cause the crash as it first attempts to call ethtool_get_coalesce() and bails out on error.

Weakness: CWE-476

Which versions are affected by CVE-2021-47556?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2021-47556?

Apply the vendor's patch.

Is CVE-2021-47556 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as DEBIAN-CVE-2021-47556, UBUNTU-CVE-2021-47556.

Is CVE-2021-47556 in your software?

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

Check your SBOMs for free