Skip to content

Commit ebbdf64

Browse files
committed
crypto: ahash - Zero positive err value in ahash_update_finish
The partial block length returned by a block-only driver should not be passed up to the caller since ahash itself deals with the partial block data. Set err to zero in ahash_update_finish if it was positive. Reported-by: T Pratham <t-pratham@ti.com> Tested-by: T Pratham <t-pratham@ti.com> Fixes: 9d7a0ab ("crypto: ahash - Handle partial blocks in API") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent b0356b7 commit ebbdf64

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

crypto/ahash.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,11 @@ static int ahash_update_finish(struct ahash_request *req, int err)
423423

424424
req->nbytes += nonzero - blen;
425425

426-
blen = err < 0 ? 0 : err + nonzero;
426+
blen = 0;
427+
if (err >= 0) {
428+
blen = err + nonzero;
429+
err = 0;
430+
}
427431
if (ahash_request_isvirt(req))
428432
memcpy(buf, req->svirt + req->nbytes - blen, blen);
429433
else

0 commit comments

Comments
 (0)