Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4d8817c authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Vinod Koul
Browse files

dmaengine: edma: Fetch echan->edesc while holding lock in edma_comletion_handler



In order to avoid possible race condition when client drivers are using
dmaengine_terminate_sync() call to disable the channel.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Suggested-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent b84730ff
Loading
Loading
Loading
Loading
+27 −27
Original line number Diff line number Diff line
@@ -1369,12 +1369,11 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
static void edma_completion_handler(struct edma_chan *echan)
{
	struct device *dev = echan->vchan.chan.device->dev;
	struct edma_desc *edesc = echan->edesc;

	if (!edesc)
		return;
	struct edma_desc *edesc;

	spin_lock(&echan->vchan.lock);
	edesc = echan->edesc;
	if (edesc) {
		if (edesc->cyclic) {
			vchan_cyclic_callback(&edesc->vdesc);
			spin_unlock(&echan->vchan.lock);
@@ -1399,6 +1398,7 @@ static void edma_completion_handler(struct edma_chan *echan)
			edesc->processed_stat = edesc->processed;
		}
		edma_execute(echan);
	}

	spin_unlock(&echan->vchan.lock);
}