linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: ccp - Fix a resource leak in an error handling path
@ 2021-05-16  6:58 Christophe JAILLET
  2021-05-19 20:56 ` John Allen
  2021-05-21  8:23 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-05-16  6:58 UTC (permalink / raw)
  To: thomas.lendacky, john.allen, herbert, davem, gary.hook, brijesh.singh
  Cc: linux-crypto, linux-kernel, kernel-janitors, Christophe JAILLET

If an error occurs after calling 'sp_get_irqs()', 'sp_free_irqs()' must be
called as already done in the error handling path.

Fixes: f4d18d656f88 ("crypto: ccp - Abstract interrupt registeration")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/crypto/ccp/sp-pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
index f468594ef8af..6fb6ba35f89d 100644
--- a/drivers/crypto/ccp/sp-pci.c
+++ b/drivers/crypto/ccp/sp-pci.c
@@ -222,7 +222,7 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		if (ret) {
 			dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n",
 				ret);
-			goto e_err;
+			goto free_irqs;
 		}
 	}
 
@@ -230,10 +230,12 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	ret = sp_init(sp);
 	if (ret)
-		goto e_err;
+		goto free_irqs;
 
 	return 0;
 
+free_irqs:
+	sp_free_irqs(sp);
 e_err:
 	dev_notice(dev, "initialization failed\n");
 	return ret;
-- 
2.30.2


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

* Re: [PATCH] crypto: ccp - Fix a resource leak in an error handling path
  2021-05-16  6:58 [PATCH] crypto: ccp - Fix a resource leak in an error handling path Christophe JAILLET
@ 2021-05-19 20:56 ` John Allen
  2021-05-21  8:23 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: John Allen @ 2021-05-19 20:56 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: thomas.lendacky, herbert, davem, gary.hook, brijesh.singh,
	linux-crypto, linux-kernel, kernel-janitors

On Sun, May 16, 2021 at 08:58:04AM +0200, Christophe JAILLET wrote:
> If an error occurs after calling 'sp_get_irqs()', 'sp_free_irqs()' must be
> called as already done in the error handling path.
> 
> Fixes: f4d18d656f88 ("crypto: ccp - Abstract interrupt registeration")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: John Allen <john.allen@amd.com>

> ---
>  drivers/crypto/ccp/sp-pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
> index f468594ef8af..6fb6ba35f89d 100644
> --- a/drivers/crypto/ccp/sp-pci.c
> +++ b/drivers/crypto/ccp/sp-pci.c
> @@ -222,7 +222,7 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  		if (ret) {
>  			dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n",
>  				ret);
> -			goto e_err;
> +			goto free_irqs;
>  		}
>  	}
>  
> @@ -230,10 +230,12 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	ret = sp_init(sp);
>  	if (ret)
> -		goto e_err;
> +		goto free_irqs;
>  
>  	return 0;
>  
> +free_irqs:
> +	sp_free_irqs(sp);
>  e_err:
>  	dev_notice(dev, "initialization failed\n");
>  	return ret;
> -- 
> 2.30.2
> 

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

* Re: [PATCH] crypto: ccp - Fix a resource leak in an error handling path
  2021-05-16  6:58 [PATCH] crypto: ccp - Fix a resource leak in an error handling path Christophe JAILLET
  2021-05-19 20:56 ` John Allen
@ 2021-05-21  8:23 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-05-21  8:23 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: thomas.lendacky, john.allen, davem, gary.hook, brijesh.singh,
	linux-crypto, linux-kernel, kernel-janitors

On Sun, May 16, 2021 at 08:58:04AM +0200, Christophe JAILLET wrote:
> If an error occurs after calling 'sp_get_irqs()', 'sp_free_irqs()' must be
> called as already done in the error handling path.
> 
> Fixes: f4d18d656f88 ("crypto: ccp - Abstract interrupt registeration")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/crypto/ccp/sp-pci.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2021-05-21  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-16  6:58 [PATCH] crypto: ccp - Fix a resource leak in an error handling path Christophe JAILLET
2021-05-19 20:56 ` John Allen
2021-05-21  8:23 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).