Skip to content

Commit d9503be

Browse files
povikvinodkoul
authored andcommitted
dmaengine: apple-admac: Fix 'current_tx' not getting freed
In terminate_all we should queue up all submitted descriptors to be freed. We do that for the content of the 'issued' and 'submitted' lists, but the 'current_tx' descriptor falls through the cracks as it's removed from the 'issued' list once it gets assigned to be the current descriptor. Explicitly queue up freeing of the 'current_tx' descriptor to address a memory leak that is otherwise present. Fixes: b127315 ("dmaengine: apple-admac: Add Apple ADMAC driver") Signed-off-by: Martin Povišer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 6e96adc commit d9503be

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/dma/apple-admac.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,10 @@ static int admac_terminate_all(struct dma_chan *chan)
512512
admac_stop_chan(adchan);
513513
admac_reset_rings(adchan);
514514

515-
adchan->current_tx = NULL;
515+
if (adchan->current_tx) {
516+
list_add_tail(&adchan->current_tx->node, &adchan->to_free);
517+
adchan->current_tx = NULL;
518+
}
516519
/*
517520
* Descriptors can only be freed after the tasklet
518521
* has been killed (in admac_synchronize).

0 commit comments

Comments
 (0)