Commit 9da75de0 authored by LABBE Corentin's avatar LABBE Corentin Committed by Herbert Xu

crypto: sunxi-ss - Fix a possible driver hang with ciphers

The sun4i_ss_opti_poll function cipher data until the output miter have
a length of 0.
If the crypto API client, give more SGs than necessary this could result
in an infinite loop.
Fix it by checking for remaining bytes, just like sun4i_ss_cipher_poll().
Signed-off-by: default avatarLABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f1ab4287
...@@ -104,7 +104,7 @@ static int sun4i_ss_opti_poll(struct ablkcipher_request *areq) ...@@ -104,7 +104,7 @@ static int sun4i_ss_opti_poll(struct ablkcipher_request *areq)
sg_miter_next(&mo); sg_miter_next(&mo);
oo = 0; oo = 0;
} }
} while (mo.length > 0); } while (oleft > 0);
if (areq->info) { if (areq->info) {
for (i = 0; i < 4 && i < ivsize / 4; i++) { for (i = 0; i < 4 && i < ivsize / 4; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment