CVE-2024-26807: spi: cadence-qspi: fix pointer reference in runtime PM hooks
In the Linux kernel, the following vulnerability has been resolved:
Both cadence-quadspi ->runtimesuspend() and ->runtimeresume() implementations start with:
struct cqspist cqspi = devgetdrvdata(dev); struct spicontroller host = devgetdrvdata(dev);
This obviously cannot be correct, unless "struct cqspist" is the first member of " struct spicontroller", or the other way around, but it is not the case. "struct spicontroller" is allocated by devmspiallochost(), which allocates an extra amount of memory for private data, used to store "struct cqspist".
The ->probe() function of the cadence-quadspi driver then sets the device drvdata to store the address of the "struct cqspist" structure. Therefore:
struct cqspist cqspi = devgetdrvdata(dev);
is correct, but:
struct spicontroller host = devgetdrvdata(dev);
is not, as it makes "host" point not to a "struct spicontroller" but to the same "struct cqspist" structure as above.
This obviously leads to bad things (memory corruption, kernel crashes) directly during ->probe(), as ->probe() enables the device using PM runtime, leading the ->runtimeresume() hook being called, which in turns calls spicontrollerresume() with the wrong pointer.
This has at least been reported [0] to cause a kernel crash, but the exact behavior will depend on the memory contents.
[0] https://lore.kernel.org/all/20240226121803.5a7r5wkpbbowcxgx@dhruva/
This issue potentially affects all platforms that are currently using the cadence-quadspi driver.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
ubuntu/linux-raspi-realtimeto a version that resolves this vulnerability.Fixed in 6.8.0-2002.2 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.140-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.7.9-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.115-2Fixed in 7.2.12-1Fixed in 7.2.15-1
Event History
Frequently Asked Questions
What is the severity of CVE-2024-26807?
The severity of CVE-2024-26807 is classified depending on the specific impact it could have on the Linux kernel, typical evaluations consider factors like potential data loss or unauthorized access.
How do I fix CVE-2024-26807?
To fix CVE-2024-26807, you should update your Linux kernel to the latest patched version that addresses this vulnerability.
What systems are affected by CVE-2024-26807?
CVE-2024-26807 affects various versions of the Linux kernel that implement certain aspects of the cadence-quadspi SPI controller.
What is the nature of the vulnerability CVE-2024-26807?
CVE-2024-26807 is related to improper handling in the cadence-quadspi module during runtime suspend and resume processes.
Are there any known exploits for CVE-2024-26807?
As of now, there are no widely reported or known exploits specifically targeting CVE-2024-26807 in the wild.