Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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++) {