From a1be7936af049dfc0d6f63e82f6faeda8fbf9746 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 20 Mar 2025 16:40:02 +0000 Subject: [PATCH] dmaengine: dw-axi-dmac: Improve axi_desc_put axi_desc_put often gets called in error paths, and so can't assume that the descriptor passed in has been completely initialised. Guard against unallocated LLIs. See: https://github.com/raspberrypi/linux/issues/6733 Signed-off-by: Phil Elwell --- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -367,7 +367,8 @@ static void axi_desc_put(struct axi_dma_ for (descs_put = 0; descs_put < count; descs_put++) { hw_desc = &desc->hw_desc[descs_put]; - dma_pool_free(chan->desc_pool, hw_desc->lli, hw_desc->llp); + if (hw_desc->lli) + dma_pool_free(chan->desc_pool, hw_desc->lli, hw_desc->llp); } kfree(desc->hw_desc);