CVE-2026-99164

spi: imx: fix slab corruption from undersized DMA bounce buffers

Published Oct 28, 2026 CVSS 3.1 · 7.8 High EPSS < 1% KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

spi: imx: fix slab corruption from undersized DMA bounce buffers

Since commit faa8e404ad8e ("spi: imx: support dynamic burst length for
ECSPI DMA mode"), the driver allocates its private DMA TX/RX buffers
with kzalloc(dma_len), where dma_len is only rounded up to 4 bytes, but
maps, syncs and unmaps them with DMA_CACHE_ALIGNED_LEN(dma_len), i.e.
rounded up to the cache line size. As a result, the DMA API operates on
memory beyond the end of the allocation.

This was observed on a custom i.MX8MP platform with an mcp251xfd CAN
controller under heavy RPMSG load, as a series of refcount_t warnings
triggered from rpmsg_recv_done() in virtio_rpmsg_bus:

refcount_t: addition on 0; use-after-free.
refcount_t: underflow; use-after-free.
refcount_t: saturated; leaking memory.

Leading finally to an "Unable to handle kernel paging request" oops.
Reproducing this problem took between 30 minutes and roughly 30 hours
under the same workload.

Hardware watchpoints on the refcount of a struct rpmsg_endpoint showed
it was overwritten from 2 to 1 by __pi_memcpy_generic() in the
irq/155-spi2.0 thread. Additionally it was found that a "normal"
rpmsg_recv_done() took 11µs +/-2µs from its kref_get to kref_put. In
the error case the same sequence took about 215µs +/-10µs. Based on
this, an LLM was used to identify the size mismatch fixed here.

Allocate the buffers with DMA_CACHE_ALIGNED_LEN(dma_len) so they cover
the full mapped length, and use the same length for
dma_sync_single_for_cpu() to stay consistent with map and unmap.

With this patch applied, the same workload ran for more than 200 hours
without the problem reproducing.

Analysis

AI-generated

Technical impact

The vulnerability arises when the i.MX SPI driver in the Linux kernel allocates DMA transmit and receive buffers with a size that is only rounded to 4 bytes, but the driver maps, synchronizes, and unmaps those buffers using a cache‑aligned length that is larger. This mismatch allows the DMA engine to write past the end of the allocated buffer, corrupting adjacent memory. The corruption manifests as refcount_t warnings and, in observed workloads, culminates in a kernel crash (“Unable to handle kernel paging request”). The result is loss of system stability and, if an attacker can influence the DMA activity, potentially creating a local privilege escalation scenario—this possibility is inferred from the resultant memory corruption but is not explicitly confirmed in the description.

Affected Systems

This issue affects the Linux kernel's imx SPI driver on ARM‑based i.MX platforms (e.g., i.MX8MP) that use the ECC DMA mode before the commit that applied the fix. Kernels prior to that commit are potentially vulnerable when the feature is enabled. Systems that do not use the imx SPI driver or the affected ECC DMA mode are not exposed.

Risk and Exploitability

The CVSS score is 7.8. The EPSS score is <1%. The vulnerability is not listed in the CISA KEV catalog. Exploitation requires interacting with the affected SPI device and inducing DMA transfers that trigger the buffer under‑allocation—conditions that were observed under heavy RPMSG load. The requirement of sustained traffic and the lack of a readily available exploit suggests a moderate difficulty triggering. If the memory corruption can be controlled, an attacker with local access may be able to leverage it for privilege escalation, but the likelihood and exact methods remain unconfirmed.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Linux kernel to a version containing commit 2777f6637da02da84c9c1ff92f413ce0f0995084 or newer, which corrects the DMA buffer allocation length.
  • If an immediate kernel upgrade is not possible, disable the imx SPI driver or remove the ECC DMA mode from the configuration and reboot the system to eliminate the vulnerable code path.
  • Monitor the system for refcount_t or kref warnings that may indicate residual corruption; if such warnings appear, schedule a kernel update as soon as possible.

Generated by OpenCVE AI on November 2, 2026 at 01:51 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-122
CWE-416
Type Values Removed Values Added
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

Type Values Removed Values Added
First Time appeared Linux linux
Vendors & Products Linux linux
Type Values Removed Values Added
Weaknesses CWE-122
CWE-416
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: spi: imx: fix slab corruption from undersized DMA bounce buffers Since commit faa8e404ad8e ("spi: imx: support dynamic burst length for ECSPI DMA mode"), the driver allocates its private DMA TX/RX buffers with kzalloc(dma_len), where dma_len is only rounded up to 4 bytes, but maps, syncs and unmaps them with DMA_CACHE_ALIGNED_LEN(dma_len), i.e. rounded up to the cache line size. As a result, the DMA API operates on memory beyond the end of the allocation. This was observed on a custom i.MX8MP platform with an mcp251xfd CAN controller under heavy RPMSG load, as a series of refcount_t warnings triggered from rpmsg_recv_done() in virtio_rpmsg_bus: refcount_t: addition on 0; use-after-free. refcount_t: underflow; use-after-free. refcount_t: saturated; leaking memory. Leading finally to an "Unable to handle kernel paging request" oops. Reproducing this problem took between 30 minutes and roughly 30 hours under the same workload. Hardware watchpoints on the refcount of a struct rpmsg_endpoint showed it was overwritten from 2 to 1 by __pi_memcpy_generic() in the irq/155-spi2.0 thread. Additionally it was found that a "normal" rpmsg_recv_done() took 11µs +/-2µs from its kref_get to kref_put. In the error case the same sequence took about 215µs +/-10µs. Based on this, an LLM was used to identify the size mismatch fixed here. Allocate the buffers with DMA_CACHE_ALIGNED_LEN(dma_len) so they cover the full mapped length, and use the same length for dma_sync_single_for_cpu() to stay consistent with map and unmap. With this patch applied, the same workload ran for more than 200 hours without the problem reproducing.
Title spi: imx: fix slab corruption from undersized DMA bounce buffers
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Oct 31, 2026, 12:44 PM
Reserved
Sep 25, 2026, 10:25 AM
Status
Received
Published
Oct 28, 2026, 11:17 AM
Modified
Oct 31, 2026, 1:17 PM
Severity
Moderate
Public date
Oct 28, 2026, 10:35 AM