pdc_handle_error() calls pdc_first_active(pd_chan), which wraps list_first_entry() on pd_chan->active_list, without checking whether active_list is empty. If active_list was drained before the error tasklet runs, bad_desc points to an invalid descriptor derived from the list head and list_del(&bad_desc->desc_node) corrupts the list. Return early in pdc_handle_error() if pd_chan->active_list is empty. Found by LLM-assisted static analysis. Compile-tested on x86_64. Fixes: 0c42bd0e425e ("dmaengine: Driver for Topcliff PCH DMA controller") Cc: stable@vger.kernel.org Signed-off-by: Ziheng Wei --- drivers/dma/pch_dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index 88baf7ffe..3c897797c 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c @@ -369,6 +369,9 @@ static void pdc_handle_error(struct pch_dma_chan *pd_chan) { struct pch_dma_desc *bad_desc; + if (list_empty(&pd_chan->active_list)) + return; + bad_desc = pdc_first_active(pd_chan); list_del(&bad_desc->desc_node); base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa -- 2.43.0