summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-08-25 16:49:51 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2016-08-31 22:50:40 +0800
commitc8346f455b3fe4296e7d504e943e0cd67e25d78a (patch)
tree2326fa1be1047065ef9d4c02ca0f4326b3e2b5c6
parentc5df76a185f097d771c0851daddcac1e7ee75d0a (diff)
downloadlinux-crypto-c8346f455b3fe4296e7d504e943e0cd67e25d78a.tar.gz
linux-crypto-c8346f455b3fe4296e7d504e943e0cd67e25d78a.zip
crypto: cryptd - Use correct tfm object for AEAD tracking
The AEAD code path incorrectly uses the child tfm to track the cryptd refcnt, and then potentially frees the child tfm. Fixes: d7a0f8f86515 ("crypto: cryptd - Add helpers to check...") Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/cryptd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index cf8037a8..77207b41 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -733,13 +733,14 @@ static void cryptd_aead_crypt(struct aead_request *req,
rctx = aead_request_ctx(req);
compl = rctx->complete;
+ tfm = crypto_aead_reqtfm(req);
+
if (unlikely(err == -EINPROGRESS))
goto out;
aead_request_set_tfm(req, child);
err = crypt( req );
out:
- tfm = crypto_aead_reqtfm(req);
ctx = crypto_aead_ctx(tfm);
refcnt = atomic_read(&ctx->refcnt);