diff mbox series

dmaengine: virt-dma:fix vchan_dma_desc_free_list list_del corruption.

Message ID 1703567717-71861-1-git-send-email-yi.shao@semidrive.com (mailing list archive)
State Changes Requested
Headers show
Series dmaengine: virt-dma:fix vchan_dma_desc_free_list list_del corruption. | expand

Commit Message

yi.shao Dec. 26, 2023, 5:15 a.m. UTC
To resolve the race problem when terminating a cyclic transfer,
dmaengine calls vchan_terminate_vdesc() from the DMA terminate_all
function.

When configuring the CONFIG_DEBUG_LIST macro, it detects a list
corruption error in the vchan_dma_desc_free_list function, displaying
the following message: "[54.964702] list_del corruption. prev->next
should be ffffa0001395a0b8, but it was ffffa000180a7950".

This error occurs because the virt_dma_desc remains in the
vc->desc_issued list.To resolve this issue, the vchan_terminate_vdesc
function should remove the descriptor from vc->desc_issued and then
add it to vc->desc_terminated.

Signed-off-by: yi.shao <yi.shao@semidrive.com>
---
 drivers/dma/virt-dma.h | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h
index e9f5250..eee97d2 100644
--- a/drivers/dma/virt-dma.h
+++ b/drivers/dma/virt-dma.h
@@ -146,6 +146,7 @@  static inline void vchan_terminate_vdesc(struct virt_dma_desc *vd)
 {
 	struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
 
+	list_del(&vd->node);
 	list_add_tail(&vd->node, &vc->desc_terminated);
 
 	if (vc->cyclic == vd)