All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
@ 2021-01-24  7:09 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-01-24  7:09 UTC (permalink / raw)
  To: peter.ujfalusi, dan.j.williams, vkoul
  Cc: dmaengine, linux-kernel, kernel-janitors, Christophe JAILLET

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>
---
This patch is not even compile tested.
I don't have the needed configuration.
---
 drivers/dma/ti/k3-udma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 8e3fd1119a77..96ad21869ba7 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -2447,7 +2447,8 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
 			dev_err(ud->ddev.dev,
 				"Descriptor pool allocation failed\n");
 			uc->use_dma_pool = false;
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto err_res_free;
 		}
 
 		uc->use_dma_pool = true;
-- 
2.27.0


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

* [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
@ 2021-01-24  7:09 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-01-24  7:09 UTC (permalink / raw)
  To: peter.ujfalusi, dan.j.williams, vkoul
  Cc: dmaengine, linux-kernel, kernel-janitors, Christophe JAILLET

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>
---
This patch is not even compile tested.
I don't have the needed configuration.
---
 drivers/dma/ti/k3-udma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 8e3fd1119a77..96ad21869ba7 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -2447,7 +2447,8 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
 			dev_err(ud->ddev.dev,
 				"Descriptor pool allocation failed\n");
 			uc->use_dma_pool = false;
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto err_res_free;
 		}
 
 		uc->use_dma_pool = true;
-- 
2.27.0

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

* Re: [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
  2021-01-24  7:09 ` Christophe JAILLET
@ 2021-01-25 11:13   ` Péter Ujfalusi
  -1 siblings, 0 replies; 6+ messages in thread
From: Péter Ujfalusi @ 2021-01-25 11:13 UTC (permalink / raw)
  To: Christophe JAILLET, dan.j.williams, vkoul
  Cc: dmaengine, linux-kernel, kernel-janitors

Hi,

On 1/24/21 9:09 AM, Christophe JAILLET wrote:
> 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.

Interesting that I only had error for the bcdma path...

> Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is not even compile tested.
> I don't have the needed configuration.

No issue, that patch is trivial,

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> ---
>   drivers/dma/ti/k3-udma.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 8e3fd1119a77..96ad21869ba7 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -2447,7 +2447,8 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
>   			dev_err(ud->ddev.dev,
>   				"Descriptor pool allocation failed\n");
>   			uc->use_dma_pool = false;
> -			return -ENOMEM;
> +			ret = -ENOMEM;
> +			goto err_res_free;
>   		}
>   
>   		uc->use_dma_pool = true;
> 

-- 
Péter

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

* Re: [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
@ 2021-01-25 11:13   ` Péter Ujfalusi
  0 siblings, 0 replies; 6+ messages in thread
From: Péter Ujfalusi @ 2021-01-25 11:13 UTC (permalink / raw)
  To: Christophe JAILLET, dan.j.williams, vkoul
  Cc: dmaengine, linux-kernel, kernel-janitors

Hi,

On 1/24/21 9:09 AM, Christophe JAILLET wrote:
> 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.

Interesting that I only had error for the bcdma path...

> Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is not even compile tested.
> I don't have the needed configuration.

No issue, that patch is trivial,

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> ---
>   drivers/dma/ti/k3-udma.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 8e3fd1119a77..96ad21869ba7 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -2447,7 +2447,8 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
>   			dev_err(ud->ddev.dev,
>   				"Descriptor pool allocation failed\n");
>   			uc->use_dma_pool = false;
> -			return -ENOMEM;
> +			ret = -ENOMEM;
> +			goto err_res_free;
>   		}
>   
>   		uc->use_dma_pool = true;
> 

-- 
Péter

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

* Re: [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
  2021-01-24  7:09 ` Christophe JAILLET
@ 2021-01-26 17:44   ` Vinod Koul
  -1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2021-01-26 17:32 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: peter.ujfalusi, dan.j.williams, dmaengine, linux-kernel, kernel-janitors

On 24-01-21, 08:09, Christophe JAILLET wrote:
> 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.

Applied, thanks

-- 
~Vinod

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

* Re: [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path
@ 2021-01-26 17:44   ` Vinod Koul
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2021-01-26 17:44 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: peter.ujfalusi, dan.j.williams, dmaengine, linux-kernel, kernel-janitors

On 24-01-21, 08:09, Christophe JAILLET wrote:
> 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.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2021-01-26 21:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24  7:09 [PATCH] dmaengine: ti: k3-udma: Fix a resource leak in an error handling path Christophe JAILLET
2021-01-24  7:09 ` Christophe JAILLET
2021-01-25 11:13 ` Péter Ujfalusi
2021-01-25 11:13   ` Péter Ujfalusi
2021-01-26 17:32 ` Vinod Koul
2021-01-26 17:44   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.