diff --git a/patches.kernel.org/6.2.12-046-dmaengine-apple-admac-Fix-current_tx-not-getti.patch b/patches.kernel.org/6.2.12-046-dmaengine-apple-admac-Fix-current_tx-not-getti.patch new file mode 100644 index 0000000..5622a22 --- /dev/null +++ b/patches.kernel.org/6.2.12-046-dmaengine-apple-admac-Fix-current_tx-not-getti.patch @@ -0,0 +1,48 @@ +From: =?UTF-8?q?Martin=20Povi=C5=A1er?= +Date: Fri, 24 Feb 2023 16:22:21 +0100 +Subject: [PATCH] dmaengine: apple-admac: Fix 'current_tx' not getting freed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: d9503be5a100c553731c0e8a82c7b4201e8a970c + +[ Upstream commit d9503be5a100c553731c0e8a82c7b4201e8a970c ] + +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: b127315d9a78 ("dmaengine: apple-admac: Add Apple ADMAC driver") +Signed-off-by: Martin PoviĊĦer +Link: https://lore.kernel.org/r/20230224152222.26732-2-povik+lin@cutebit.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +Signed-off-by: Jiri Slaby +--- + drivers/dma/apple-admac.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c +index b9132b49..4cf8da77 100644 +--- a/drivers/dma/apple-admac.c ++++ b/drivers/dma/apple-admac.c +@@ -512,7 +512,10 @@ static int admac_terminate_all(struct dma_chan *chan) + admac_stop_chan(adchan); + admac_reset_rings(adchan); + +- adchan->current_tx = NULL; ++ if (adchan->current_tx) { ++ list_add_tail(&adchan->current_tx->node, &adchan->to_free); ++ adchan->current_tx = NULL; ++ } + /* + * Descriptors can only be freed after the tasklet + * has been killed (in admac_synchronize). +-- +2.35.3 + diff --git a/series.conf b/series.conf index eca1f43..ecec66c 100644 --- a/series.conf +++ b/series.conf @@ -2273,6 +2273,7 @@ patches.kernel.org/6.2.12-043-LoongArch-bpf-Fix-jit-to-skip-speculation-barr.patch patches.kernel.org/6.2.12-044-dmaengine-apple-admac-Handle-global-interrupt-.patch patches.kernel.org/6.2.12-045-dmaengine-apple-admac-Set-src_addr_widths-capa.patch + patches.kernel.org/6.2.12-046-dmaengine-apple-admac-Fix-current_tx-not-getti.patch ######################################################## # Build fixes that apply to the vanilla kernel too.