Commit 8dac1d15 authored by Michael Grzeschik's avatar Michael Grzeschik Committed by Greg Kroah-Hartman

dmaengine: imx-dma: fix callback path in tasklet

commit fcaaba6c upstream.

We need to free the ld_active list head before jumping into the callback
routine. Otherwise the callback could run into issue_pending and change
our ld_active list head we just going to free. This will run the channel
list into an currupted and undefined state.
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Cc: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16c72f37
......@@ -604,13 +604,11 @@ static void imxdma_tasklet(unsigned long data)
if (list_empty(&imxdmac->ld_active)) {
/* Someone might have called terminate all */
goto out;
spin_unlock_irqrestore(&imxdma->lock, flags);
return;
}
desc = list_first_entry(&imxdmac->ld_active, struct imxdma_desc, node);
if (desc->desc.callback)
desc->desc.callback(desc->desc.callback_param);
/* If we are dealing with a cyclic descriptor, keep it on ld_active
* and dont mark the descriptor as complete.
* Only in non-cyclic cases it would be marked as complete
......@@ -638,6 +636,10 @@ static void imxdma_tasklet(unsigned long data)
}
out:
spin_unlock_irqrestore(&imxdma->lock, flags);
if (desc->desc.callback)
desc->desc.callback(desc->desc.callback_param);
}
static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment