1 From 4967ec844a52498af050b1176fedeca37aca111e Mon Sep 17 00:00:00 2001
2 From: Robin Gong <yibin.gong@nxp.com>
3 Date: Tue, 16 Oct 2018 01:06:29 +0800
4 Subject: [PATCH] MLK-19931-1: dmaengine: fsl-edma-v3: fix potential kernel
7 There is one potential race condition in virt-dma framework as below:
8 terminate dma channel after the last dma done interrupt, but before
9 vchan_complete tasklet scheduled, thus the free-ed 'vd' (free in
10 fsl_edma3_terminate_all) maybe still be touched in vchan_complete()
11 which cause NULL pointer crash.
12 Kernel community noticed this issue and fix it at virt-dma level:
13 https://patchwork.kernel.org/patch/10057791/. To avoid backport too
14 much patches, set 'vc->cyclic = NULL' in terminate dma channel
15 interfaces to fix such issue easily.
17 Signed-off-by: Robin Gong <yibin.gong@nxp.com>
18 Acked-by: Fugang Duan <fugang.duan@nxp.com>
19 (cherry picked from commit 18c9083826400a2ef731496391a0b5e71d461a5f)
21 drivers/dma/fsl-edma-v3.c | 1 +
22 1 file changed, 1 insertion(+)
24 --- a/drivers/dma/fsl-edma-v3.c
25 +++ b/drivers/dma/fsl-edma-v3.c
26 @@ -285,6 +285,7 @@ static int fsl_edma3_terminate_all(struc
27 fsl_chan->edesc = NULL;
28 fsl_chan->idle = true;
29 fsl_chan->used = false;
30 + fsl_chan->vchan.cyclic = NULL;
31 vchan_get_all_descriptors(&fsl_chan->vchan, &head);
32 spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags);
33 vchan_dma_desc_free_list(&fsl_chan->vchan, &head);