All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] crypto: caam - fix memleak in caam_jr module
@ 2014-07-07  8:52 Cristian Stoica
  2014-07-10  9:00 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Cristian Stoica @ 2014-07-07  8:52 UTC (permalink / raw)
  To: Herbert Xu
  Cc: linux-crypto, linux-kernel, David S. Miller, Ruchika Gupta,
	Garg Vakul-B16394, Cristian Stoica, stable

This patch fixes a memory leak that appears when caam_jr module is unloaded.

Cc: <stable@vger.kernel.org> # 3.13+
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
---
 drivers/crypto/caam/jr.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 1d80bd3..b512a4b 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -453,8 +453,8 @@ static int caam_jr_probe(struct platform_device *pdev)
 	int error;
 
 	jrdev = &pdev->dev;
-	jrpriv = kmalloc(sizeof(struct caam_drv_private_jr),
-			 GFP_KERNEL);
+	jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr),
+			      GFP_KERNEL);
 	if (!jrpriv)
 		return -ENOMEM;
 
@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev)
 
 	/* Now do the platform independent part */
 	error = caam_jr_init(jrdev); /* now turn on hardware */
-	if (error) {
-		kfree(jrpriv);
+	if (error)
 		return error;
-	}
 
 	jrpriv->dev = jrdev;
 	spin_lock(&driver_data.jr_alloc_lock);
-- 
1.8.3.1

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

* Re: [PATCH v3] crypto: caam - fix memleak in caam_jr module
  2014-07-07  8:52 [PATCH v3] crypto: caam - fix memleak in caam_jr module Cristian Stoica
@ 2014-07-10  9:00 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2014-07-10  9:00 UTC (permalink / raw)
  To: Cristian Stoica
  Cc: linux-crypto, linux-kernel, David S. Miller, Ruchika Gupta,
	Garg Vakul-B16394, stable

On Mon, Jul 07, 2014 at 11:52:41AM +0300, Cristian Stoica wrote:
> This patch fixes a memory leak that appears when caam_jr module is unloaded.
> 
> Cc: <stable@vger.kernel.org> # 3.13+
> Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>

Patch applied.
-- 
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] 2+ messages in thread

end of thread, other threads:[~2014-07-10  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07  8:52 [PATCH v3] crypto: caam - fix memleak in caam_jr module Cristian Stoica
2014-07-10  9:00 ` Herbert Xu

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.