CVE-2026-23431: spi: amlogic-spisg: Fix memory leak in aml_spisg_probe()
In the Linux kernel, the following vulnerability has been resolved:
spi: amlogic-spisg: Fix memory leak in amlspisgprobe()
In amlspisgprobe(), ctlr is allocated by spialloctarget()/spiallochost(), but fails to call spicontrollerput() in several error paths. This leads to a memory leak whenever the driver fails to probe after the initial allocation.
Convert to use devmspiallochost()/devmspialloctarget() to fix the memory leak.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In aml_spisg_probe(), allocate ctlr using devm_spi_alloc_host()/devm_spi_alloc_target() so the controller is properly released on error paths.
Linux kernel driver: spi: amlogic-spisg (aml_spisg_probe) Use devm_spi_alloc_host()/devm_spi_alloc_target() instead of spi_alloc_host()/spi_alloc_target() = devm_spi_alloc_host()/devm_spi_alloc_target() - Configuration
Fix the probe error paths in aml_spisg_probe() to ensure spi_controller_put() is called when allocation leads to a controller that needs releasing; this resolves the memory leak when probe fails after spi_alloc_target()/spi_alloc_host().
Linux kernel driver: spi: amlogic-spisg (aml_spisg_probe) Error-path cleanup = Call spi_controller_put()