Skip to content

Commit

Permalink
crypto: algif_hash - wait for crypto_ahash_init() to complete
Browse files Browse the repository at this point in the history
commit fe09786 upstream.

hash_sendmsg/sendpage() need to wait for the completion
of crypto_ahash_init() otherwise it can cause panic.

Signed-off-by: Rui Wang <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
ruiwang1 authored and sashalevin committed Apr 28, 2016
1 parent 70a28e3 commit cfb4b3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/algif_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock,

lock_sock(sk);
if (!ctx->more) {
err = crypto_ahash_init(&ctx->req);
err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req),
&ctx->completion);
if (err)
goto unlock;
}
Expand Down Expand Up @@ -128,6 +129,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page,
} else {
if (!ctx->more) {
err = crypto_ahash_init(&ctx->req);
err = af_alg_wait_for_completion(err, &ctx->completion);
if (err)
goto unlock;
}
Expand Down

0 comments on commit cfb4b3c

Please sign in to comment.