CVE-2026-99164 in Linuxinfo

Summary

by MITRE • 10/28/2026

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.

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 10/28/2026

The Linux kernel SPI driver for NXP i.MX platforms contains a critical memory management flaw related to DMA buffer allocation and synchronization. The vulnerability stems from an inconsistency between the size of allocated memory buffers and the length parameters used during Direct Memory Access operations. Specifically, following commit faa8e404ad8e which introduced support for dynamic burst lengths in ECSPI DMA mode, the driver allocates private TX and RX buffers using kzalloc with a length rounded up to four bytes. However, when mapping these buffers for DMA transfer, syncing them for CPU access, or unmapping them after completion, the code utilizes macros that round the length up to the cache line size. This discrepancy means the Linux kernel DMA API operates on memory regions extending beyond the actual boundaries of the allocated slab object. Such out-of-bounds access constitutes a classic buffer over-read and potential write scenario within the kernel space, violating fundamental principles of safe memory management where operations must remain strictly confined to allocated resources.

The operational impact of this flaw manifests as severe system instability under specific high-load conditions involving RPMSG communication channels. When subjected to heavy traffic on platforms such as i.MX8MP with MCP251FD CAN controllers, the out-of-bounds DMA operations corrupt adjacent kernel memory structures. This corruption is most visibly observed through refcount_t anomalies in the virtio_rpmsg_bus subsystem, where reference counts exhibit underflows or saturations indicative of use-after-free conditions and memory leaks. These internal state corruptions eventually lead to critical kernel panics described as unable to handle kernel paging requests due to invalid memory accesses. The intermittent nature of the bug makes it particularly dangerous for production environments; reproduction times vary widely from thirty minutes to over thirty hours depending on workload intensity, making standard testing protocols potentially insufficient to detect the issue without prolonged stress testing or specialized debugging tools like hardware watchpoints that can trace specific register modifications back to the offending DMA copy operations.

From a technical classification perspective, this vulnerability aligns with CWE-120 Buffer Copy without Checking Size of Input and CWE-787 Out-of-bounds Write, as the driver writes data into memory regions it does not own due to incorrect length calculations during synchronization phases. In terms of attack surface and behavior mapping within the MITRE ATT&CK framework for Enterprise, this flaw relates to T1059 Command and Scripting Interpreter via kernel exploitation vectors where an attacker might leverage local privilege escalation by triggering these race conditions or memory corruptions to gain arbitrary code execution capabilities. The root cause is a failure in input validation regarding buffer sizing parameters passed to DMA subsystems, highlighting the necessity for rigorous alignment checks when interfacing hardware peripherals with software buffers that require cache coherency management.

To mitigate this vulnerability and restore system integrity, the driver must be patched to ensure consistency between allocation sizes and operational lengths. The primary remediation involves modifying the kzalloc call to use DMA_CACHE_ALIGNED_LEN(dma_len) instead of a simple four-byte rounding mechanism. This ensures that the allocated memory region is sufficiently large to accommodate any cache line padding required by the hardware architecture during DMA transfers. Furthermore, the dma_sync_single_for_cpu calls must be updated to utilize this same aligned length parameter rather than the original unaligned value. By aligning the allocation size with the synchronization and mapping lengths, the driver prevents out-of-bounds memory access events that lead to refcount corruption and subsequent kernel crashes. This fix has been validated through extended stress testing exceeding two hundred hours under previously problematic workloads, confirming the elimination of the race condition and associated memory safety violations.

Responsible

Linux

Reservation

09/25/2026

Disclosure

10/28/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!