Commit 9f91e6bf authored by Sascha Hauer's avatar Sascha Hauer Committed by Vinod Koul
Browse files

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: default avatarSascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191216105328.15198-6-s.hauer@pengutronix.de


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent f8821011
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -113,11 +113,16 @@ 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);
	}
}

/**
 * vchan_cyclic_callback - report the completion of a period