Skip to content

Commit 18dedde

Browse files
ambarusvinodkoul
authored andcommitted
dmaengine: at_xdmac: Fix concurrency over xfers_list
Since tx_submit can be called from a hard IRQ, xfers_list must be protected with a lock to avoid concurency on the list's elements. Since at_xdmac_handle_cyclic() is called from a tasklet, spin_lock_irq is enough to protect from a hard IRQ. Fixes: e1f7c9e ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver") Signed-off-by: Tudor Ambarus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 801db90 commit 18dedde

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/dma/at_xdmac.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,14 +1608,17 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan)
16081608
struct at_xdmac_desc *desc;
16091609
struct dma_async_tx_descriptor *txd;
16101610

1611-
if (!list_empty(&atchan->xfers_list)) {
1612-
desc = list_first_entry(&atchan->xfers_list,
1613-
struct at_xdmac_desc, xfer_node);
1614-
txd = &desc->tx_dma_desc;
1615-
1616-
if (txd->flags & DMA_PREP_INTERRUPT)
1617-
dmaengine_desc_get_callback_invoke(txd, NULL);
1611+
spin_lock_irq(&atchan->lock);
1612+
if (list_empty(&atchan->xfers_list)) {
1613+
spin_unlock_irq(&atchan->lock);
1614+
return;
16181615
}
1616+
desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc,
1617+
xfer_node);
1618+
spin_unlock_irq(&atchan->lock);
1619+
txd = &desc->tx_dma_desc;
1620+
if (txd->flags & DMA_PREP_INTERRUPT)
1621+
dmaengine_desc_get_callback_invoke(txd, NULL);
16191622
}
16201623

16211624
static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)

0 commit comments

Comments
 (0)