diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-12-16 11:53:24 +0100 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2019-12-26 10:04:18 +0530 |
commit | 9f91e6bfa8666270565fb76d883db2ba2e441585 (patch) | |
tree | cc8ca3b1edec9a95bc6356e5e587f6d4f267d8e0 /drivers | |
parent | f882101122aa110ef8e64be04472e5a47030300e (diff) |
dmaengine: virt-dma: Add missing locking around list operations
All list operations are protected by &vc->lock. As vchan_vdesc_fini()
is called unlocked add the missing locking around the list operations.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191216105328.15198-6-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/virt-dma.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h index e213137b6bc1..e9f5250fbe4d 100644 --- a/drivers/dma/virt-dma.h +++ b/drivers/dma/virt-dma.h @@ -113,10 +113,15 @@ static inline void vchan_vdesc_fini(struct virt_dma_desc *vd) { struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan); - if (dmaengine_desc_test_reuse(&vd->tx)) + if (dmaengine_desc_test_reuse(&vd->tx)) { + unsigned long flags; + + spin_lock_irqsave(&vc->lock, flags); list_add(&vd->node, &vc->desc_allocated); - else + spin_unlock_irqrestore(&vc->lock, flags); + } else { vc->desc_free(vd); + } } /** |