summary refs log tree commit diff
path: root/drivers/dma
diff options
context:
space:
mode:
authorAkhil R <akhilrajeev@nvidia.com>2023-01-18 17:28:01 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-01 08:34:24 +0100
commit567128076d554e41609c61b7d447089094ff72c5 (patch)
tree7cbdcb0712e28b4c0d57f0665731ffd957b5cd34 /drivers/dma
parentf7a57ef457ad81a04e016d19e56a9469c2245862 (diff)
downloadlinux-567128076d554e41609c61b7d447089094ff72c5.tar.gz
dmaengine: tegra: Fix memory leak in terminate_all()
[ Upstream commit a7a7ee6f5a019ad72852c001abbce50d35e992f2 ]

Terminate vdesc when terminating an ongoing transfer.
This will ensure that the vdesc is present in the desc_terminated list
The descriptor will be freed later in desc_free_list().

This fixes the memory leaks which can happen when terminating an
ongoing transfer.

Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Link: https://lore.kernel.org/r/20230118115801.15210-1-akhilrajeev@nvidia.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/tegra186-gpc-dma.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index fa9bda4a2bc6..75af3488a3ba 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -707,6 +707,7 @@ static int tegra_dma_terminate_all(struct dma_chan *dc)
 			return err;
 		}
 
+		vchan_terminate_vdesc(&tdc->dma_desc->vd);
 		tegra_dma_disable(tdc);
 		tdc->dma_desc = NULL;
 	}