summaryrefslogtreecommitdiff
path: root/crypto/algif_hash.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-11-23 09:18:09 +0300
committerIngo Molnar <mingo@kernel.org>2016-11-23 09:18:09 +0300
commit064e6a8ba61a751625478f656c6f76a6f37a009e (patch)
treea22d84d037543f74b6c86969c7e87ab799768de9 /crypto/algif_hash.c
parentaf25ed59b5616b389d90877f7085dc5d457a3d49 (diff)
parent23400ac997062647f2b63c82030d189671b1effe (diff)
downloadlinux-064e6a8ba61a751625478f656c6f76a6f37a009e.tar.xz
Merge branch 'linus' into x86/fpu, to resolve conflicts
Conflicts: arch/x86/kernel/fpu/core.c Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'crypto/algif_hash.c')
-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 2d8466f9e49b..05e21b464433 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) {
+ 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;