>From 9618f1f4f068b4272d1034e63a5d6cd501084d2a Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 10 Feb 2016 08:55:44 +0200 Subject: [RFC 2/3] dmaengine: omap-dma: Prevent race between vchan_complete() and terminate_all Implement protection against vchan_complete() calling the client callback after the channel has been terminated. Signed-off-by: Peter Ujfalusi --- drivers/dma/omap-dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index bfdf29aa3428..1912be81e56d 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c @@ -980,7 +980,9 @@ static int omap_dma_terminate_all(struct dma_chan *chan) unsigned long flags; LIST_HEAD(head); + tasklet_disable(&c->vc.task); spin_lock_irqsave(&c->vc.lock, flags); + vchan_terminate(&c->vc); /* * Stop DMA activity: we assume the callback will not be called @@ -1003,6 +1005,7 @@ static int omap_dma_terminate_all(struct dma_chan *chan) vchan_get_all_descriptors(&c->vc, &head); spin_unlock_irqrestore(&c->vc.lock, flags); vchan_dma_desc_free_list(&c->vc, &head); + tasklet_enable(&c->vc.task); return 0; } -- 2.7.1