From: Herbert Xu Date: Sun, 31 May 2009 13:09:22 +0000 (+1000) Subject: crypto: hash - Fix handling of sg entry that crosses page boundary X-Git-Tag: v2.6.30-rc8~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d315a0e09f1c8b833cacd5e72f3edea419978138;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git crypto: hash - Fix handling of sg entry that crosses page boundary A quirk that we've always supported is having an sg entry that's bigger than a page, or more generally an sg entry that crosses page boundaries. Even though it would be better to explicitly have to sg entries for this, we need to support it for the existing users, in particular, IPsec. The new ahash sg walking code did try to handle this, but there was a bug where we didn't increment the page so kept on walking on the first page over an dover again. This patch fixes it. Tested-by: Martin Willi Signed-off-by: Herbert Xu --- diff --git a/crypto/ahash.c b/crypto/ahash.c index b2d1ee3..f347637 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c @@ -82,10 +82,11 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) if (err) return err; - walk->offset = 0; - - if (nbytes) + if (nbytes) { + walk->offset = 0; + walk->pg++; return hash_walk_next(walk); + } if (!walk->total) return 0;