[3.13.y.z extended stable] Patch "crypto: caam - fix memleak in caam_jr module" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Wed Aug 6 20:54:29 UTC 2014


This is a note to let you know that I have just added a patch titled

    crypto: caam - fix memleak in caam_jr module

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11.6.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From cc9f41d874e07a0382d727122f70adbde4252e5b Mon Sep 17 00:00:00 2001
From: Cristian Stoica <cristian.stoica at freescale.com>
Date: Mon, 7 Jul 2014 11:52:41 +0300
Subject: crypto: caam - fix memleak in caam_jr module

commit 0378c9a855bfa395f595fbfb049707093e270f69 upstream.

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

Signed-off-by: Cristian Stoica <cristian.stoica at freescale.com>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal at canonical.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.9.1





More information about the kernel-team mailing list