summaryrefslogtreecommitdiff
path: root/crypto/algif_hash.c
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2016-12-27 12:53:44 -0700
committerJonathan Corbet <corbet@lwn.net>2016-12-27 12:53:44 -0700
commit1bd9a34ffdd5f22ef74ed68b5d8b6fb4b781d58c (patch)
tree3f9b77b397ec915c0eb026a9b6425e82fa843e67 /crypto/algif_hash.c
parent239a79b2f922a0614334cef0aab2f8a23a4e54f9 (diff)
parent46cc85f2e4aef88c237a0407cf5d163619a4d565 (diff)
downloadlinux-crypto-1bd9a34ffdd5f22ef74ed68b5d8b6fb4b781d58c.tar.gz
linux-crypto-1bd9a34ffdd5f22ef74ed68b5d8b6fb4b781d58c.zip
Merge tag 'v4.10-rc1' into docs-next
Linux 4.10-rc1
Diffstat (limited to '')
-rw-r--r--crypto/algif_hash.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 2d8466f9..d19b09cd 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -214,23 +214,26 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0);
- if (ctx->more) {
+ if (!result && !ctx->more) {
+ err = af_alg_wait_for_completion(
+ crypto_ahash_init(&ctx->req),
+ &ctx->completion);
+ if (err)
+ goto unlock;
+ }
+
+ if (!result || ctx->more) {
ctx->more = 0;
err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req),
&ctx->completion);
if (err)
goto unlock;
- } else if (!result) {
- err = af_alg_wait_for_completion(
- crypto_ahash_digest(&ctx->req),
- &ctx->completion);
}
err = memcpy_to_msg(msg, ctx->result, len);
- hash_free_result(sk, ctx);
-
unlock:
+ hash_free_result(sk, ctx);
release_sock(sk);
return err ?: len;