Skip to content

Commit fcaaba6

Browse files
mgrzeschikVinod Koul
authored andcommitted
dmaengine: imx-dma: fix callback path in tasklet
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: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent 5a276fa commit fcaaba6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/dma/imx-dma.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,13 +627,11 @@ static void imxdma_tasklet(unsigned long data)
627627

628628
if (list_empty(&imxdmac->ld_active)) {
629629
/* Someone might have called terminate all */
630-
goto out;
630+
spin_unlock_irqrestore(&imxdma->lock, flags);
631+
return;
631632
}
632633
desc = list_first_entry(&imxdmac->ld_active, struct imxdma_desc, node);
633634

634-
if (desc->desc.callback)
635-
desc->desc.callback(desc->desc.callback_param);
636-
637635
/* If we are dealing with a cyclic descriptor, keep it on ld_active
638636
* and dont mark the descriptor as complete.
639637
* Only in non-cyclic cases it would be marked as complete
@@ -661,6 +659,10 @@ static void imxdma_tasklet(unsigned long data)
661659
}
662660
out:
663661
spin_unlock_irqrestore(&imxdma->lock, flags);
662+
663+
if (desc->desc.callback)
664+
desc->desc.callback(desc->desc.callback_param);
665+
664666
}
665667

666668
static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,

0 commit comments

Comments
 (0)