]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 29 Sep 2014 18:06:45 +0000 (20:06 +0200)
committerVinod Koul <vinod.koul@intel.com>
Wed, 15 Oct 2014 15:25:04 +0000 (20:55 +0530)
commit57dcd2173cc3b93a5596f5fec57d2dfa8b032e61
tree591b19fff5dd83dc097f6402cc927117fe5eafe6
parentd789ce0068ff3fe830ac2dd41cab5cb4fe1d57e6
dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause()

I added book keeping of whether or not the 8250-dma driver has an RX
transfer pending or not so we don't BUG here if it calls
dmaengine_pause() on a channel which has not a pending transfer. Guess
what, this is not enough.
The following can be triggered with a busy RX channel and hackbench in
background:
- DMA transfer completes. The callback is delayed via
  vchan_cookie_complete() into a tasklet so it das not happen asap.
- hackbench keeps the system busy so the tasklet does not run "soon".
- the UART collected enough data and generates an "timeout"-interrupt.
  Since 8250-dma *thinks* the DMA-transfer is still pending it tries to
  cancel it via invoking dmaengine_pause() first. This causes the segfault
  because echan->edesc is NULL now that the transfer completed (however
  the callback did not run yet).

With this patch we don't BUG in the scenario described.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/edma.c