Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

LABBE Corentin and committed by
Herbert Xu
9da75de0 f1ab4287

+1 -1
+1 -1
drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
··· 104 104 sg_miter_next(&mo); 105 105 oo = 0; 106 106 } 107 - } while (mo.length > 0); 107 + } while (oleft > 0); 108 108 109 109 if (areq->info) { 110 110 for (i = 0; i < 4 && i < ivsize / 4; i++) {