Thread (28 messages) 28 messages, 6 authors, 2008-04-04

Re: HIFN+IPsec crashes in current -git

From: Patrick McHardy <hidden>
Date: 2008-02-21 14:21:06

Evgeniy Polyakov wrote:
quoted hunk ↗ jump to hunk
Hi Herbert.

On Thu, Feb 21, 2008 at 10:10:13PM +0800, Herbert Xu (herbert@gondor.apana.org.au) wrote:
quoted
Yes by the time the request gets to hifn req->nbytes would have
been decremented by 12 bytes which means that it is now the exact
amount of data that needs to be encrypted.

However, if you follow the scatterlist then you will see more data
available which is normal.
Argh, I see.

Then following patch should help.

Signed-off-by: Evgeniy Polyakov <redacted>
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index dfbf24c..81b8f2f 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -1544,7 +1544,10 @@ static int ablkcipher_walk(struct ablkcipher_request *req,
 
 			kunmap_atomic(daddr, KM_SOFTIRQ0);
 		} else {
-			nbytes -= src->length;
+			if (src->length > nbytes)
+				nbytes = 0;
+			else
+				nbytes -= src->length;
 			idx++;
 		}
 
Almost I guess :) There are similar loops in hifn_setup_session().
Additionally we need to check that the return value of ablkcipher_walk()
is not a negative errno code.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help