* [PATCH 2/6] crypto: Fix scatterwalk_done() test.
@ 2010-05-18 5:22 David Miller
2010-05-19 4:05 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2010-05-18 5:22 UTC (permalink / raw)
To: linux-crypto; +Cc: herbert
We are done with the scattergather entry when the walk offset goes
past sg->offset + sg->length, not when it crosses a page boundary.
There is a similarly queer test in the second half of
scatterwalk_pagedone() that probably needs some scrutiny.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
crypto/scatterwalk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 3de89a4..b3acf4f 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -68,7 +68,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
void scatterwalk_done(struct scatter_walk *walk, int out, int more)
{
- if (!offset_in_page(walk->offset) || !more)
+ if (walk->offset >= walk->sg->offset + walk->sg->length || !more)
scatterwalk_pagedone(walk, out, more);
}
EXPORT_SYMBOL_GPL(scatterwalk_done);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/6] crypto: Fix scatterwalk_done() test.
2010-05-18 5:22 [PATCH 2/6] crypto: Fix scatterwalk_done() test David Miller
@ 2010-05-19 4:05 ` Herbert Xu
2010-05-19 5:54 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2010-05-19 4:05 UTC (permalink / raw)
To: David Miller; +Cc: linux-crypto
On Mon, May 17, 2010 at 10:22:37PM -0700, David Miller wrote:
>
> We are done with the scattergather entry when the walk offset goes
> past sg->offset + sg->length, not when it crosses a page boundary.
Thanks for catching this!
> There is a similarly queer test in the second half of
> scatterwalk_pagedone() that probably needs some scrutiny.
I double-checked that one but can't see any problems yet.
> diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
> index 3de89a4..b3acf4f 100644
> --- a/crypto/scatterwalk.c
> +++ b/crypto/scatterwalk.c
> @@ -68,7 +68,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
>
> void scatterwalk_done(struct scatter_walk *walk, int out, int more)
> {
> - if (!offset_in_page(walk->offset) || !more)
> + if (walk->offset >= walk->sg->offset + walk->sg->length || !more)
> scatterwalk_pagedone(walk, out, more);
I think we need to keep the original test as well as otherwise
if we hit a page boundary while the sg spans over a page (that
can happen with a linearised jumbo skb->head for example) then
we'd be screwed.
So I'm going to commit this patch instead. Let me know if you
see any other issues with it.
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 3de89a4..41e529a 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -68,7 +68,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
void scatterwalk_done(struct scatter_walk *walk, int out, int more)
{
- if (!offset_in_page(walk->offset) || !more)
+ if (!(scatterwalk_pagelen(walk) & (PAGE_SIZE - 1)) || !more)
scatterwalk_pagedone(walk, out, more);
}
EXPORT_SYMBOL_GPL(scatterwalk_done);
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/6] crypto: Fix scatterwalk_done() test.
2010-05-19 4:05 ` Herbert Xu
@ 2010-05-19 5:54 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-05-19 5:54 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 19 May 2010 14:05:13 +1000
> So I'm going to commit this patch instead. Let me know if you
> see any other issues with it.
Looks good:
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-19 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18 5:22 [PATCH 2/6] crypto: Fix scatterwalk_done() test David Miller
2010-05-19 4:05 ` Herbert Xu
2010-05-19 5:54 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).