]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: omap-dma: fix dma_pool resource leak in error paths
authorHaotian Zhang <vulab@iscas.ac.cn>
Mon, 3 Nov 2025 07:30:18 +0000 (15:30 +0800)
committerVinod Koul <vkoul@kernel.org>
Sun, 11 Jan 2026 16:42:44 +0000 (22:12 +0530)
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>
Link: https://patch.msgid.link/20251103073018.643-1-vulab@iscas.ac.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/ti/omap-dma.c

index 8c023c6e623a5aae4754ea5423bf9575e2e9ed81..73ed4b79463047df05bc10cd18935063206a7212 100644 (file)
@@ -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);
                }
        }