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: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
LABBE Corentin 2015-09-09 14:27:07 +02:00 committed by Herbert Xu
parent f1ab428711
commit 9da75de030
1 changed files with 1 additions and 1 deletions

View File

@ -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++) {