Skip to content

Commit 8995aa3

Browse files
krzkvinodkoul
authored andcommitted
dmaengine: mcf-edma: Fix NULL pointer exception in mcf_edma_tx_handler
On Toradex Colibri VF50 (Vybrid VF5xx) with fsl-edma driver NULL pointer exception happens occasionally on serial output initiated by login timeout. This was reproduced only if kernel was built with significant debugging options and EDMA driver is used with serial console. Issue looks like a race condition between interrupt handler fsl_edma_tx_handler() (called as a result of fsl_edma_xfer_desc()) and terminating the transfer with fsl_edma_terminate_all(). The fsl_edma_tx_handler() handles interrupt for a transfer with already freed edesc and idle==true. The mcf-edma driver shares design and lot of code with fsl-edma. It looks like being affected by same problem. Fix this pattern the same way as fix for fsl-edma driver. Fixes: e7a3ff9 ("dmaengine: fsl-edma: add ColdFire mcf5441x edma support") Cc: <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Robin Gong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent f5e5677 commit 8995aa3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/dma/mcf-edma.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ static irqreturn_t mcf_edma_tx_handler(int irq, void *dev_id)
3535
mcf_chan = &mcf_edma->chans[ch];
3636

3737
spin_lock(&mcf_chan->vchan.lock);
38+
39+
if (!mcf_chan->edesc) {
40+
/* terminate_all called before */
41+
spin_unlock(&mcf_chan->vchan.lock);
42+
continue;
43+
}
44+
3845
if (!mcf_chan->edesc->iscyclic) {
3946
list_del(&mcf_chan->edesc->vdesc.node);
4047
vchan_cookie_complete(&mcf_chan->edesc->vdesc);

0 commit comments

Comments
 (0)