Skip to content

Commit 43c9646

Browse files
outman119gregkh
authored andcommitted
spi: ep93xx: fix double-free of zeropage on DMA setup failure
[ Upstream commit 7886054 ] 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: 626a96d ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 94f7e50 commit 43c9646

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/spi/spi-ep93xx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
625625
espi->dma_rx = NULL;
626626
fail_free_page:
627627
free_page((unsigned long)espi->zeropage);
628+
espi->zeropage = NULL;
628629

629630
return ret;
630631
}

0 commit comments

Comments
 (0)