CVE-2026-143096: spi: axi-spi-engine: Start the program length at zero
In the Linux kernel, the following vulnerability has been resolved:
spi: axi-spi-engine: Start the program length at zero
spiengineoptimizemessage() allocates the program with kzallocflex(), which sets the countedby() counter "length" to the allocated size when the compiler supports builtincountedbyref(). The program is then filled by spiengineprogramaddcmd(), which increments "length" and stores at length - 1, expecting it to start at zero as it did when the program came from kzalloc().
Reset "length" after the allocation, since it is a "usage" counter, not a "total allocation" counter.
Build tested ARCH=x8664 defconfig with CONFIGSPIAXISPIENGINE=m and W=1, with GCC 16.2.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In spi_engine_optimize_message(), reset the program's length counter to zero after allocation; kzalloc_flex() initializes the __counted_by() counter to the allocated size.