From: Herbert Xu Date: Fri, 16 Jan 2009 03:40:54 +0000 (+1100) Subject: crypto: blkcipher - Fix WARN_ON handling in walk_done X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=bac1b5c4696f217afeac5b29874a337bc39da717;p=openwrt%2Fstaging%2Fblogic.git crypto: blkcipher - Fix WARN_ON handling in walk_done When we get left-over bits from a slow walk, it means that the underlying cipher has gone troppo. However, as we're handling that case we should ensure that the caller terminates the walk. This patch does this by setting walk->nbytes to zero. Reported-by: Roel Kluin Reported-by: Huang Ying Signed-off-by: Herbert Xu --- diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 4a7e65c4df4d..d70a41c002df 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c @@ -124,6 +124,7 @@ int blkcipher_walk_done(struct blkcipher_desc *desc, scatterwalk_done(&walk->in, 0, nbytes); scatterwalk_done(&walk->out, 1, nbytes); +err: walk->total = nbytes; walk->nbytes = nbytes; @@ -132,7 +133,6 @@ int blkcipher_walk_done(struct blkcipher_desc *desc, return blkcipher_walk_next(desc, walk); } -err: if (walk->iv != desc->info) memcpy(desc->info, walk->iv, crypto_blkcipher_ivsize(tfm)); if (walk->buffer != walk->page)