dmaengine: nbpfaxi: fix a theoretical race
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Sun, 3 Aug 2014 17:13:03 +0000 (19:13 +0200)
committerVinod Koul <vinod.koul@intel.com>
Mon, 4 Aug 2014 08:00:31 +0000 (13:30 +0530)
A race possibility exists if a DMA slave driver tries to free channel
resources witout waiting for all transfers to complete and without
explicitly terminating all requests. In such a case the IRQ processing
thread can race with .device_free_chan_resources(). To fix this race empty
all descriptor lists before freeing descriptor cache.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/nbpfaxi.c

index 77c5a890a30aa16d849a9e26ef92a4cf32399a06..5b40ac8d82d1e606b2fe35aac7557caf3d5df688 100644 (file)
@@ -1054,6 +1054,7 @@ static void nbpf_free_chan_resources(struct dma_chan *dchan)
        dev_dbg(dchan->device->dev, "Entry %s()\n", __func__);
 
        nbpf_chan_halt(chan);
+       nbpf_chan_idle(chan);
        /* Clean up for if a channel is re-used for MEMCPY after slave DMA */
        nbpf_chan_prepare_default(chan);