linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: sun4i-ss Fix a possible driver hang with ciphers
@ 2015-09-09 12:27 LABBE Corentin
  2015-09-10  9:26 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: LABBE Corentin @ 2015-09-09 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
index e070c31..a19ee12 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -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++) {
-- 
2.4.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] crypto: sun4i-ss Fix a possible driver hang with ciphers
  2015-09-09 12:27 [PATCH] crypto: sun4i-ss Fix a possible driver hang with ciphers LABBE Corentin
@ 2015-09-10  9:26 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2015-09-10  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 09, 2015 at 02:27:07PM +0200, LABBE Corentin wrote:
> 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>

Applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-10  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09 12:27 [PATCH] crypto: sun4i-ss Fix a possible driver hang with ciphers LABBE Corentin
2015-09-10  9:26 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).