Skip to content

Commit

Permalink
crypto: algif_hash - Fix result clobbering in recvmsg
Browse files Browse the repository at this point in the history
Recently an init call was added to hash_recvmsg so as to reset
the hash state in case a sendmsg call was never made.

Unfortunately this ended up clobbering the result if the previous
sendmsg was done with a MSG_MORE flag.  This patch fixes it by
excluding that case when we make the init call.

Fixes: a8348bc ("algif_hash - Fix NULL hash crash with shash")
Reported-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Nov 22, 2016
1 parent a8348bc commit 8acf7a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/algif_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,

ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0);

if (!result) {
if (!result && !ctx->more) {
err = af_alg_wait_for_completion(
crypto_ahash_init(&ctx->req),
&ctx->completion);
Expand Down

0 comments on commit 8acf7a1

Please sign in to comment.