omap-dma: fix dma_pool resource leak in error paths
Subsystems (2)
PATCH 1/1 omap-dma: fix dma_pool resource leak in error paths
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 <[email protected]>
--- drivers/dma/ti/omap-dma.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/ti/omap-dma.c +4 -0
@@ -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); } }
Signature · 1 line
2.50.1.windows.1
Quoted 8 lines · Haotian Zhang
The
dma_poolcreated bydma_pool_create()is not destroyed whendma_async_device_register()orof_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 allocateddma_poolresource.[...]
Applied, thanks!
[1/1] omap-dma: fix dma_pool resource leak in error paths
commit: 7b28c670df4508a7cb1ee31cb159b4366fcc6d4b
Best regards,
Signature · 1 line
~Vinod