Skip to content

Commit

Permalink
crypto: cryptd - Use correct tfm object for AEAD tracking
Browse files Browse the repository at this point in the history
The AEAD code path incorrectly uses the child tfm to track the
cryptd refcnt, and then potentially frees the child tfm.

Fixes: 81760ea ("crypto: cryptd - Add helpers to check...")
Reported-by: Sowmini Varadhan <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Aug 31, 2016
1 parent 901d3d4 commit 31bd44e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/cryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 31bd44e

Please sign in to comment.