linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@freescale.com>
To: <linux-crypto@vger.kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH 1/7] crypto: talitos - fix bad kfree
Date: Mon, 12 Dec 2011 14:59:10 -0600	[thread overview]
Message-ID: <1323723556-7100-2-git-send-email-kim.phillips@freescale.com> (raw)
In-Reply-To: <1323723556-7100-1-git-send-email-kim.phillips@freescale.com>

Fix a kfree to an invalid address which causes an oops when running
on SEC v2.0 h/w (introduced in commit 702331b "crypto: talitos - add
hmac algorithms").

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
 drivers/crypto/talitos.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 230509e..d376cc7 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -2626,8 +2626,10 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
 		alg = &t_alg->algt.alg.hash.halg.base;
 		alg->cra_init = talitos_cra_init_ahash;
 		if (!(priv->features & TALITOS_FTR_HMAC_OK) &&
-		    !strncmp(alg->cra_name, "hmac", 4))
+		    !strncmp(alg->cra_name, "hmac", 4)) {
+			kfree(t_alg);
 			return ERR_PTR(-ENOTSUPP);
+		}
 		if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) &&
 		    (!strcmp(alg->cra_name, "sha224") ||
 		     !strcmp(alg->cra_name, "hmac(sha224)"))) {
@@ -2835,10 +2837,8 @@ static int talitos_probe(struct platform_device *ofdev)
 			t_alg = talitos_alg_alloc(dev, &driver_algs[i]);
 			if (IS_ERR(t_alg)) {
 				err = PTR_ERR(t_alg);
-				if (err == -ENOTSUPP) {
-					kfree(t_alg);
+				if (err == -ENOTSUPP)
 					continue;
-				}
 				goto err_out;
 			}
 
-- 
1.7.8

  reply	other threads:[~2011-12-12 21:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 20:59 [PATCH 0/7] crypto: talitos/caam: SEC h/w v2.0 fix and cleanups Kim Phillips
2011-12-12 20:59 ` Kim Phillips [this message]
2011-12-12 20:59 ` [PATCH 2/7] crypto: talitos - remove NO_IRQ references Kim Phillips
2011-12-12 20:59 ` [PATCH 3/7] crypto: talitos - convert talitos_error to struct device Kim Phillips
2011-12-12 20:59 ` [PATCH 5/7] crypto: caam - more desc.h cleanups Kim Phillips
2011-12-12 20:59 ` [PATCH 6/7] crypto: caam - fix polarity of "propagate error" logic Kim Phillips
2011-12-12 20:59 ` [PATCH 7/7] crypto: caam - remove DECO access initialization code Kim Phillips
2011-12-20  7:24 ` [PATCH 0/7] crypto: talitos/caam: SEC h/w v2.0 fix and cleanups Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323723556-7100-2-git-send-email-kim.phillips@freescale.com \
    --to=kim.phillips@freescale.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).