linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: tegra: Fix memory leak in terminate_all()
@ 2023-01-18 11:58 Akhil R
  2023-01-18 16:48 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Akhil R @ 2023-01-18 11:58 UTC (permalink / raw)
  To: ldewangan, jonathanh, vkoul, thierry.reding, p.zabel, dmaengine,
	linux-tegra, linux-kernel
  Cc: akhilrajeev

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>
---
 drivers/dma/tegra186-gpc-dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index 1d1180db6d4e..8f67f453a492 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -711,6 +711,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;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: tegra: Fix memory leak in terminate_all()
  2023-01-18 11:58 [PATCH] dmaengine: tegra: Fix memory leak in terminate_all() Akhil R
@ 2023-01-18 16:48 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2023-01-18 16:48 UTC (permalink / raw)
  To: Akhil R
  Cc: ldewangan, jonathanh, thierry.reding, p.zabel, dmaengine,
	linux-tegra, linux-kernel

On 18-01-23, 17:28, Akhil R wrote:
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-18 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 11:58 [PATCH] dmaengine: tegra: Fix memory leak in terminate_all() Akhil R
2023-01-18 16:48 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).