diff options
author | Robin Gong <yibin.gong@nxp.com> | 2017-05-24 16:28:43 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-24 12:41:33 +0300 |
commit | 346007009521eb6dbf481781bfa3e4ad22f86a64 (patch) | |
tree | b479b567fcb193f5b0eb04d4dd108b2f4c8303a5 /drivers/dma | |
parent | 63bb30e1081ad8498807ee277affe11fc9978cca (diff) |
MLK-14976: dma: virt-dma: free description after callback
Some drivers may access dma_async_tx_descriptor in callback such as
tty/serial/fsl_lpuart.c, but the description has already been freed
before callback, memory corrupt here. Move the free description
behind of callback.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/virt-dma.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/dma/virt-dma.c b/drivers/dma/virt-dma.c index e47fc9b0944f..c940cec61f39 100644 --- a/drivers/dma/virt-dma.c +++ b/drivers/dma/virt-dma.c @@ -108,12 +108,13 @@ static void vchan_complete(unsigned long arg) dmaengine_desc_get_callback(&vd->tx, &cb); list_del(&vd->node); + + dmaengine_desc_callback_invoke(&cb, NULL); + if (dmaengine_desc_test_reuse(&vd->tx)) list_add(&vd->node, &vc->desc_allocated); else vc->desc_free(vd); - - dmaengine_desc_callback_invoke(&cb, NULL); } } |