CVE-2025-40014 objtool, spi: amd: Fix out-of-bounds stack access in amd_set_spi_freq()

High 7.8 Published Updated

An out-of-bounds stack access in the AMD SPI driver can cause a kernel crash, requiring a patch to prevent denial of service.

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-40014?

CVE-2025-40014 is a high-severity memory corruption vulnerability in Linux kernel, published on 18 Apr 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:

objtool, spi: amd: Fix out-of-bounds stack access in amd_set_spi_freq()

If speed_hz < AMD_SPI_MIN_HZ, amd_set_spi_freq() iterates over the entire amd_spi_freq array without breaking out early, causing 'i' to go beyond the array bounds.

Fix that by stopping the loop when it gets to the last entry, so the low speed_hz value gets clamped up to AMD_SPI_MIN_HZ.

Fixes the following warning with an UBSAN kernel:

drivers/spi/spi-amd.o: error: objtool: amd_set_spi_freq() falls through to next function amd_spi_set_opcode()

Weakness: CWE-129

Which versions are affected by CVE-2025-40014?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-40014?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2025-40014 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2025-40014, DEBIAN-CVE-2025-40014, GHSA-jhjh-hcm6-mrcc, ROOT-OS-DEBIAN-12-CVE-2025-40014, ROOT-OS-DEBIAN-13-CVE-2025-40014, ROOT-OS-UBUNTU-2404-CVE-2025-40014 and 1 more.

Is CVE-2025-40014 in your software?

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

Check your SBOMs for free