spi: ep93xx: fix double-free of zeropage on DMA setup failure
PATCH 1/1 spi: ep93xx: fix double-free of zeropage on DMA setup failure
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().
--- drivers/spi/spi-ep93xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-ep93xx.c +1 -0
@@ -600,6 +600,7 @@ static int ep93xx_spi_setup_dma(struct device *dev, struct ep93xx_spi *espi) espi->dma_rx =NULL ; fail_free_page:free_page ((unsigned long )espi->zeropage); + espi->zeropage =NULL ;return ret; }
---
base-commit: f7af91adc230aa99e23330ecf85bc9badd9780ad
change-id: 20260529-ep93xx-8ac307cb5434
Best regards,
Signature · 1 line
Felix Gu <[email protected]>
Mark Brown
maintainerQuoted 1 line · Felix Gu
spi: ep93xx: fix double-free of zeropage on DMA setup failure
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.2
Thanks!
[1/1] spi: ep93xx: fix double-free of zeropage on DMA setup failure
https://git.kernel.org/broonie/spi/c/7886054b06f7
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark