Out-of-Bounds Stack Access in Linux Kernel's SPI Functionality
Summary
CVE-2025-40014: 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_sp... Affects linux versions 6.1.106-1 – 6.9.9-1. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The Linux kernel is a core component of many operating systems, providing essential services for hardware and software interaction. It is known for its stability, performance, and extensive support for various hardware architectures. The kernel's SPI (Serial Peripheral Interface) subsystem facilitates communication between the CPU and peripheral devices. However, a recent vulnerability has been identified in the SPI functionality related to AMD devices, which could lead to critical security issues if not addressed.
Vulnerability Detail
The vulnerability, identified as CVE-2025-40014, arises from an out-of-bounds stack access in the function amd_set_spi_freq(). When the speed_hz parameter is less than AMD_SPI_MIN_HZ, the function iterates through the entire amd_spi_freq array without an appropriate termination condition. This oversight allows the loop index 'i' to exceed the bounds of the array, potentially leading to memory corruption or crashes. The issue was detected using the Undefined Behavior Sanitizer (UBSAN) in the kernel, which flagged the function for falling through to the next function without a proper return.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a temporary workaround, users can manually check the speed_hz parameter before calling the amd_set_spi_freq() function to ensure it does not fall below AMD_SPI_MIN_HZ. This can prevent the function from entering the problematic loop.
Conclusion
CVE-2025-40014 represents a significant vulnerability in the Linux kernel's SPI functionality, necessitating prompt action from users to mitigate potential risks. By updating to the patched version of the kernel and implementing suggested workarounds, users can protect their systems from exploitation.
See every vulnerability recorded for linux →
FAQ
CVE-2025-40014 is a vulnerability in the Linux kernel's SPI functionality that allows for out-of-bounds stack access, potentially leading to memory corruption.
You can use the Vulert platform to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected by this vulnerability.
The risks include potential memory corruption, system crashes, and exploitation by malicious actors to execute arbitrary code.
Yes, a patch has been released for the Linux kernel that addresses CVE-2025-40014. Users are encouraged to update their systems.
If an immediate update is not possible, implement the suggested workaround by validating the speed_hz parameter before invoking the affected function.
Related vulnerabilities
Recent vulnerabilities recorded for linux.