]> git.karo-electronics.de Git - linux-beck.git/commitdiff
crypto: sunxi-ss - Fix a possible driver hang with ciphers
authorLABBE Corentin <clabbe.montjoie@gmail.com>
Wed, 9 Sep 2015 12:27:07 +0000 (14:27 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 10 Sep 2015 09:22:55 +0000 (17:22 +0800)
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>
drivers/crypto/sunxi-ss/sun4i-ss-cipher.c

index e070c316e8b76a7384efa33a6a34ec99fb9a8849..a19ee127edcafd3c70ad9e6ee8a86b1823f020f7 100644 (file)
@@ -104,7 +104,7 @@ static int sun4i_ss_opti_poll(struct ablkcipher_request *areq)
                        sg_miter_next(&mo);
                        oo = 0;
                }
-       } while (mo.length > 0);
+       } while (oleft > 0);
 
        if (areq->info) {
                for (i = 0; i < 4 && i < ivsize / 4; i++) {