mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] omap-dma: fix dma_pool resource leak in error paths
@ 2025-11-03  7:30 Haotian Zhang
  2025-12-23 11:23 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2025-11-03  7:30 UTC (permalink / raw)
  To: peter.ujfalusi, vkoul; +Cc: dmaengine, linux-kernel, Haotian Zhang

The dma_pool created by dma_pool_create() is not destroyed when
dma_async_device_register() or of_dma_controller_register() fails,
causing a resource leak in the probe error paths.

Add dma_pool_destroy() in both error paths to properly release the
allocated dma_pool resource.

Fixes: 7bedaa553760 ("dmaengine: add OMAP DMA engine driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/dma/ti/omap-dma.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
index 8c023c6e623a..73ed4b794630 100644
--- a/drivers/dma/ti/omap-dma.c
+++ b/drivers/dma/ti/omap-dma.c
@@ -1808,6 +1808,8 @@ static int omap_dma_probe(struct platform_device *pdev)
 	if (rc) {
 		pr_warn("OMAP-DMA: failed to register slave DMA engine device: %d\n",
 			rc);
+		if (od->ll123_supported)
+			dma_pool_destroy(od->desc_pool);
 		omap_dma_free(od);
 		return rc;
 	}
@@ -1823,6 +1825,8 @@ static int omap_dma_probe(struct platform_device *pdev)
 		if (rc) {
 			pr_warn("OMAP-DMA: failed to register DMA controller\n");
 			dma_async_device_unregister(&od->ddev);
+			if (od->ll123_supported)
+				dma_pool_destroy(od->desc_pool);
 			omap_dma_free(od);
 		}
 	}
-- 
2.50.1.windows.1


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

* Re: [PATCH] omap-dma: fix dma_pool resource leak in error paths
  2025-11-03  7:30 [PATCH] omap-dma: fix dma_pool resource leak in error paths Haotian Zhang
@ 2025-12-23 11:23 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2025-12-23 11:23 UTC (permalink / raw)
  To: peter.ujfalusi, Haotian Zhang; +Cc: dmaengine, linux-kernel


On Mon, 03 Nov 2025 15:30:18 +0800, Haotian Zhang wrote:
> The dma_pool created by dma_pool_create() is not destroyed when
> dma_async_device_register() or of_dma_controller_register() fails,
> causing a resource leak in the probe error paths.
> 
> Add dma_pool_destroy() in both error paths to properly release the
> allocated dma_pool resource.
> 
> [...]

Applied, thanks!

[1/1] omap-dma: fix dma_pool resource leak in error paths
      commit: 7b28c670df4508a7cb1ee31cb159b4366fcc6d4b

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2025-12-23 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-03  7:30 [PATCH] omap-dma: fix dma_pool resource leak in error paths Haotian Zhang
2025-12-23 11:23 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®