Skip to content

Commit 31bd44e

Browse files
committed
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: 81760ea ("crypto: cryptd - Add helpers to check...") Reported-by: Sowmini Varadhan <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 901d3d4 commit 31bd44e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crypto/cryptd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,13 +733,14 @@ static void cryptd_aead_crypt(struct aead_request *req,
733733
rctx = aead_request_ctx(req);
734734
compl = rctx->complete;
735735

736+
tfm = crypto_aead_reqtfm(req);
737+
736738
if (unlikely(err == -EINPROGRESS))
737739
goto out;
738740
aead_request_set_tfm(req, child);
739741
err = crypt( req );
740742

741743
out:
742-
tfm = crypto_aead_reqtfm(req);
743744
ctx = crypto_aead_ctx(tfm);
744745
refcnt = atomic_read(&ctx->refcnt);
745746

0 commit comments

Comments
 (0)