Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: ti: k3-udma: Fix a resource leak in an error handling path

In 'dma_pool_create()', we return -ENOMEM, but don't release the resources
already allocated, as in all the other error handling paths.

Go to 'err_res_free' instead of returning directly.

Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20210124070923.724479-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Christophe JAILLET and committed by
Vinod Koul
fed1b6a0 e5944431

+2 -1
+2 -1
drivers/dma/ti/k3-udma.c
··· 2401 2401 dev_err(ud->ddev.dev, 2402 2402 "Descriptor pool allocation failed\n"); 2403 2403 uc->use_dma_pool = false; 2404 - return -ENOMEM; 2404 + ret = -ENOMEM; 2405 + goto err_res_free; 2405 2406 } 2406 2407 2407 2408 uc->use_dma_pool = true;