mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
dmaengine: sun6i-dma: Fix reclaim descriptors while terminating DMA
[ Upstream commitab1150115e] When terminating DMA transfers, active descriptors are not properly reclaimed. Only cyclic descriptors were handled, leaving non-cyclic descriptors and their LLI chains to be permanently leaked. Fix by using vchan_terminate_vdesc() which handles both cyclic and non-cyclic descriptors by adding them to desc_terminated queue for proper cleanup. Add pchan->desc != pchan->done check to prevent double-adding completed descriptors, which would corrupt the list. Fixes:5558593087("dmaengine: sun6i: Add driver for the Allwinner A31 DMA controller") Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Suggested-by: Frank Li <Frank.li@oss.nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260701045733.33654-1-zenghongling@kylinos.cn Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9ae18a4b22
commit
27806fe7b9
@@ -934,16 +934,13 @@ static int sun6i_dma_terminate_all(struct dma_chan *chan)
|
||||
|
||||
spin_lock_irqsave(&vchan->vc.lock, flags);
|
||||
|
||||
if (vchan->cyclic) {
|
||||
vchan->cyclic = false;
|
||||
if (pchan && pchan->desc) {
|
||||
struct virt_dma_desc *vd = &pchan->desc->vd;
|
||||
struct virt_dma_chan *vc = &vchan->vc;
|
||||
if (pchan && pchan->desc && pchan->desc != pchan->done) {
|
||||
struct virt_dma_desc *vd = &pchan->desc->vd;
|
||||
|
||||
list_add_tail(&vd->node, &vc->desc_completed);
|
||||
}
|
||||
vchan_terminate_vdesc(vd);
|
||||
}
|
||||
|
||||
vchan->cyclic = false;
|
||||
vchan_get_all_descriptors(&vchan->vc, &head);
|
||||
|
||||
if (pchan) {
|
||||
|
||||
Reference in New Issue
Block a user