Skip to content

Commit 24461d9

Browse files
Peter Ujfalusivinodkoul
authored andcommitted
dmaengine: virt-dma: Fix access after free in vchan_complete()
vchan_vdesc_fini() is freeing up 'vd' so the access to vd->tx_result is via already freed up memory. Move the vchan_vdesc_fini() after invoking the callback to avoid this. Fixes: 09d5b70 ("dmaengine: virt-dma: store result on dma descriptor") Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 2f42e05 commit 24461d9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/dma/virt-dma.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ static void vchan_complete(unsigned long arg)
104104
dmaengine_desc_get_callback(&vd->tx, &cb);
105105

106106
list_del(&vd->node);
107-
vchan_vdesc_fini(vd);
108-
109107
dmaengine_desc_callback_invoke(&cb, &vd->tx_result);
108+
vchan_vdesc_fini(vd);
110109
}
111110
}
112111

0 commit comments

Comments
 (0)