summaryrefslogtreecommitdiff
path: root/crypto/algif_hash.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-11-21 15:34:00 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2016-11-22 15:02:24 +0800
commit82b0bae9ba1105ce315d45d8436dfd03b4853d23 (patch)
tree3616cfb1fd31d4e5fc330c03cc0640360be132ff /crypto/algif_hash.c
parent19db05fdfca2b8b655b9d6d7a93387c1dc0d1fd5 (diff)
downloadlinux-crypto-82b0bae9ba1105ce315d45d8436dfd03b4853d23.tar.gz
linux-crypto-82b0bae9ba1105ce315d45d8436dfd03b4853d23.zip
crypto: algif_hash - Fix result clobbering in recvmsg
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: 19db05fdfca2 ("algif_hash - Fix NULL hash crash with shash") Reported-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algif_hash.c')
-rw-r--r--crypto/algif_hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 05e21b46..d19b09cd 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -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);