Pārlūkot izejas kodu

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 <roel.kluin@gmail.com>
Reported-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Herbert Xu 16 gadi atpakaļ
vecāks
revīzija
bac1b5c469
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      crypto/blkcipher.c

+ 1 - 1
crypto/blkcipher.c

@@ -124,6 +124,7 @@ int blkcipher_walk_done(struct blkcipher_desc *desc,
 	scatterwalk_done(&walk->in, 0, nbytes);
 	scatterwalk_done(&walk->in, 0, nbytes);
 	scatterwalk_done(&walk->out, 1, nbytes);
 	scatterwalk_done(&walk->out, 1, nbytes);
 
 
+err:
 	walk->total = nbytes;
 	walk->total = nbytes;
 	walk->nbytes = nbytes;
 	walk->nbytes = nbytes;
 
 
@@ -132,7 +133,6 @@ int blkcipher_walk_done(struct blkcipher_desc *desc,
 		return blkcipher_walk_next(desc, walk);
 		return blkcipher_walk_next(desc, walk);
 	}
 	}
 
 
-err:
 	if (walk->iv != desc->info)
 	if (walk->iv != desc->info)
 		memcpy(desc->info, walk->iv, crypto_blkcipher_ivsize(tfm));
 		memcpy(desc->info, walk->iv, crypto_blkcipher_ivsize(tfm));
 	if (walk->buffer != walk->page)
 	if (walk->buffer != walk->page)