]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: ep93xx: fix double-free of zeropage on DMA setup failure
authorFelix Gu <ustc.gu@gmail.com>
Fri, 29 May 2026 15:31:06 +0000 (23:31 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 8 Jun 2026 18:03:40 +0000 (19:03 +0100)
If DMA setup fails after allocating the zeropage, the error path frees
the page but leaves espi->zeropage dangling. A subsequent call to
ep93xx_spi_release_dma() sees the non-NULL pointer and frees the page
again.

Clear the pointer after freeing in the error path of
ep93xx_spi_setup_dma().

Fixes: 626a96db1169 ("spi/ep93xx: add DMA support")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260529-ep93xx-v1-1-9185070ca1fc@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-ep93xx.c

index ea610b0537a938e3a1246ecbfb48a4ce2a377b44..bf389d7590d35e0e259d05620be2fc8278ae96be 100644 (file)
@@ -600,6 +600,7 @@ fail_release_rx:
        espi->dma_rx = NULL;
 fail_free_page:
        free_page((unsigned long)espi->zeropage);
+       espi->zeropage = NULL;
 
        return ret;
 }