Skip to content

Commit

Permalink
crypto: sunxi-ss - Fix a possible driver hang with ciphers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
LABBE Corentin authored and Herbert Xu committed Sep 10, 2015
1 parent f1ab428 commit 9da75de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 9da75de

Please sign in to comment.