From: Tudor Ambarus Date: Wed, 15 Dec 2021 11:01:07 +0000 (+0200) Subject: dmaengine: at_xdmac: Fix concurrency over chan's completed_cookie X-Git-Tag: v5.17-rc1~45^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=506875c30fc5bf92246060bc3b4c38799646266b;p=thirdparty%2Fkernel%2Flinux.git dmaengine: at_xdmac: Fix concurrency over chan's completed_cookie Caller of dma_cookie_complete is expected to hold a lock to prevent concurrency over the channel's completed cookie marker. Call dma_cookie_complete() with the lock held. Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver") Signed-off-by: Tudor Ambarus Link: https://lore.kernel.org/r/20211215110115.191749-5-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 7d3560acedbb9..83c031207530d 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1703,11 +1703,10 @@ static void at_xdmac_tasklet(struct tasklet_struct *t) } txd = &desc->tx_dma_desc; - + dma_cookie_complete(txd); at_xdmac_remove_xfer(atchan, desc); spin_unlock_irq(&atchan->lock); - dma_cookie_complete(txd); if (txd->flags & DMA_PREP_INTERRUPT) dmaengine_desc_get_callback_invoke(txd, NULL);