Skip to content

Commit 8acf7a1

Browse files
committed
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: a8348bc ("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>
1 parent a8348bc commit 8acf7a1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crypto/algif_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
214214

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

217-
if (!result) {
217+
if (!result && !ctx->more) {
218218
err = af_alg_wait_for_completion(
219219
crypto_ahash_init(&ctx->req),
220220
&ctx->completion);

0 commit comments

Comments
 (0)