mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: fix rc7's __skb_datagram_iter()
@ 2024-07-08  3:00 Hugh Dickins
  2024-07-08  6:21 ` Sagi Grimberg
  0 siblings, 1 reply; 8+ messages in thread
From: Hugh Dickins @ 2024-07-08  3:00 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Linus Torvalds, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Hugh Dickins, netdev, linux-kernel

X would not start in my old 32-bit partition (and the "n"-handling looks
just as wrong on 64-bit, but for whatever reason did not show up there):
"n" must be accumulated over all pages before it's added to "offset" and
compared with "copy", immediately after the skb_frag_foreach_page() loop.

Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
Signed-off-by: Hugh Dickins <hughd@google.com>
---
 net/core/datagram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index e9ba4c7b449d..ea69d01156e6 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -420,6 +420,7 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 			struct page *p;
 			u8 *vaddr;
 
+			n = 0;
 			if (copy > len)
 				copy = len;
 
@@ -427,7 +428,7 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 					      skb_frag_off(frag) + offset - start,
 					      copy, p, p_off, p_len, copied) {
 				vaddr = kmap_local_page(p);
-				n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
+				n += INDIRECT_CALL_1(cb, simple_copy_to_iter,
 					vaddr + p_off, p_len, data, to);
 				kunmap_local(vaddr);
 			}
-- 
2.35.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net: fix rc7's __skb_datagram_iter()
  2024-07-08  3:00 [PATCH] net: fix rc7's __skb_datagram_iter() Hugh Dickins
@ 2024-07-08  6:21 ` Sagi Grimberg
  2024-07-08 14:46   ` [PATCH v2] " Hugh Dickins
  0 siblings, 1 reply; 8+ messages in thread
From: Sagi Grimberg @ 2024-07-08  6:21 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Linus Torvalds, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, linux-kernel



On 08/07/2024 6:00, Hugh Dickins wrote:
> X would not start in my old 32-bit partition (and the "n"-handling looks
> just as wrong on 64-bit, but for whatever reason did not show up there):
> "n" must be accumulated over all pages before it's added to "offset" and
> compared with "copy", immediately after the skb_frag_foreach_page() loop.

That is indeed strange. I see the issue. It didn't happen in my local 
testing either.

>
> Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
>   net/core/datagram.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/datagram.c b/net/core/datagram.c
> index e9ba4c7b449d..ea69d01156e6 100644
> --- a/net/core/datagram.c
> +++ b/net/core/datagram.c
> @@ -420,6 +420,7 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
>   			struct page *p;
>   			u8 *vaddr;
>   
> +			n = 0;

I think its better to reset n right before the skb_frag_foreach_page() 
iteration.

Thanks Hugh for addressing this!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] net: fix rc7's __skb_datagram_iter()
  2024-07-08  6:21 ` Sagi Grimberg
@ 2024-07-08 14:46   ` Hugh Dickins
  2024-07-08 14:47     ` Sagi Grimberg
  0 siblings, 1 reply; 8+ messages in thread
From: Hugh Dickins @ 2024-07-08 14:46 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Hugh Dickins, Linus Torvalds, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet, netdev, linux-kernel

X would not start in my old 32-bit partition (and the "n"-handling looks
just as wrong on 64-bit, but for whatever reason did not show up there):
"n" must be accumulated over all pages before it's added to "offset" and
compared with "copy", immediately after the skb_frag_foreach_page() loop.

Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
Signed-off-by: Hugh Dickins <hughd@google.com>
---
v2: moved the "n = 0" down, per Sagi: no functional change.

 net/core/datagram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index e9ba4c7b449d..e72dd78471a6 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -423,11 +423,12 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 			if (copy > len)
 				copy = len;
 
+			n = 0;
 			skb_frag_foreach_page(frag,
 					      skb_frag_off(frag) + offset - start,
 					      copy, p, p_off, p_len, copied) {
 				vaddr = kmap_local_page(p);
-				n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
+				n += INDIRECT_CALL_1(cb, simple_copy_to_iter,
 					vaddr + p_off, p_len, data, to);
 				kunmap_local(vaddr);
 			}
-- 
2.35.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: fix rc7's __skb_datagram_iter()
  2024-07-08 14:46   ` [PATCH v2] " Hugh Dickins
@ 2024-07-08 14:47     ` Sagi Grimberg
  2024-07-10 15:36       ` [PATCH v3] " Hugh Dickins
  0 siblings, 1 reply; 8+ messages in thread
From: Sagi Grimberg @ 2024-07-08 14:47 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Linus Torvalds, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, linux-kernel



On 08/07/2024 17:46, Hugh Dickins wrote:
> X would not start in my old 32-bit partition (and the "n"-handling looks
> just as wrong on 64-bit, but for whatever reason did not show up there):
> "n" must be accumulated over all pages before it's added to "offset" and
> compared with "copy", immediately after the skb_frag_foreach_page() loop.
>
> Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
> Signed-off-by: Hugh Dickins <hughd@google.com>

Thanks Hugh,

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] net: fix rc7's __skb_datagram_iter()
  2024-07-08 14:47     ` Sagi Grimberg
@ 2024-07-10 15:36       ` Hugh Dickins
  2024-07-10 16:19         ` Paolo Abeni
  2024-07-11 20:43         ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 8+ messages in thread
From: Hugh Dickins @ 2024-07-10 15:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Hugh Dickins, Sagi Grimberg, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet, Thorsten Leemhuis, regressions, netdev,
	linux-kernel

X would not start in my old 32-bit partition (and the "n"-handling looks
just as wrong on 64-bit, but for whatever reason did not show up there):
"n" must be accumulated over all pages before it's added to "offset" and
compared with "copy", immediately after the skb_frag_foreach_page() loop.

Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
---
v3: added reviewed-by Sagi, try sending direct to Linus
v2: moved the "n = 0" down, per Sagi: no functional change.

 net/core/datagram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index e9ba4c7b449d..e72dd78471a6 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -423,11 +423,12 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 			if (copy > len)
 				copy = len;
 
+			n = 0;
 			skb_frag_foreach_page(frag,
 					      skb_frag_off(frag) + offset - start,
 					      copy, p, p_off, p_len, copied) {
 				vaddr = kmap_local_page(p);
-				n = INDIRECT_CALL_1(cb, simple_copy_to_iter,
+				n += INDIRECT_CALL_1(cb, simple_copy_to_iter,
 					vaddr + p_off, p_len, data, to);
 				kunmap_local(vaddr);
 			}
-- 
2.35.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] net: fix rc7's __skb_datagram_iter()
  2024-07-10 15:36       ` [PATCH v3] " Hugh Dickins
@ 2024-07-10 16:19         ` Paolo Abeni
  2024-07-10 16:36           ` Hugh Dickins
  2024-07-11 20:43         ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 8+ messages in thread
From: Paolo Abeni @ 2024-07-10 16:19 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Sagi Grimberg, Jakub Kicinski, Eric Dumazet, Thorsten Leemhuis,
	regressions, netdev, linux-kernel, Linus Torvalds

On Wed, 2024-07-10 at 08:36 -0700, Hugh Dickins wrote:
> X would not start in my old 32-bit partition (and the "n"-handling looks
> just as wrong on 64-bit, but for whatever reason did not show up there):
> "n" must be accumulated over all pages before it's added to "offset" and
> compared with "copy", immediately after the skb_frag_foreach_page() loop.
> 
> Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
> Signed-off-by: Hugh Dickins <hughd@google.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> ---
> v3: added reviewed-by Sagi, try sending direct to Linus

V2 is already applied to the 'net' tree and will be included in our
next 'net' PR, coming tomorrow.

It looks like the netdev bot decided it needed an holiday (or was
fooled by the threaded submission for v2), so no notification landed on
the ML.

@Hugh: next time please check the current tree status or patchwork
before submitting a new revision. And please avoid submitting the new
version in reply to a previous one, it makes things difficult for our
CI.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] net: fix rc7's __skb_datagram_iter()
  2024-07-10 16:19         ` Paolo Abeni
@ 2024-07-10 16:36           ` Hugh Dickins
  0 siblings, 0 replies; 8+ messages in thread
From: Hugh Dickins @ 2024-07-10 16:36 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: Hugh Dickins, Sagi Grimberg, Jakub Kicinski, Eric Dumazet,
	Thorsten Leemhuis, regressions, netdev, linux-kernel,
	Linus Torvalds

On Wed, 10 Jul 2024, Paolo Abeni wrote:
> On Wed, 2024-07-10 at 08:36 -0700, Hugh Dickins wrote:
> > X would not start in my old 32-bit partition (and the "n"-handling looks
> > just as wrong on 64-bit, but for whatever reason did not show up there):
> > "n" must be accumulated over all pages before it's added to "offset" and
> > compared with "copy", immediately after the skb_frag_foreach_page() loop.
> > 
> > Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
> > Signed-off-by: Hugh Dickins <hughd@google.com>
> > Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> > ---
> > v3: added reviewed-by Sagi, try sending direct to Linus
> 
> V2 is already applied to the 'net' tree and will be included in our
> next 'net' PR, coming tomorrow.
> 
> It looks like the netdev bot decided it needed an holiday (or was
> fooled by the threaded submission for v2), so no notification landed on
> the ML.
> 
> @Hugh: next time please check the current tree status or patchwork
> before submitting a new revision. And please avoid submitting the new
> version in reply to a previous one, it makes things difficult for our
> CI.

Ah, great, thanks. Yes, I'd heard only silence (and was worried because,
although I only saw the effect of this on 32-bit, suspect it could cause
lots of obscure trouble more generally).

Hugh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3] net: fix rc7's __skb_datagram_iter()
  2024-07-10 15:36       ` [PATCH v3] " Hugh Dickins
  2024-07-10 16:19         ` Paolo Abeni
@ 2024-07-11 20:43         ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-11 20:43 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: torvalds, sagi, kuba, pabeni, edumazet, regressions, regressions,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 10 Jul 2024 08:36:54 -0700 (PDT) you wrote:
> X would not start in my old 32-bit partition (and the "n"-handling looks
> just as wrong on 64-bit, but for whatever reason did not show up there):
> "n" must be accumulated over all pages before it's added to "offset" and
> compared with "copy", immediately after the skb_frag_foreach_page() loop.
> 
> Fixes: d2d30a376d9c ("net: allow skb_datagram_iter to be called from any context")
> Signed-off-by: Hugh Dickins <hughd@google.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> 
> [...]

Here is the summary with links:
  - [v3] net: fix rc7's __skb_datagram_iter()
    https://git.kernel.org/netdev/net-next/c/f153831097b4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-07-11 20:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-08  3:00 [PATCH] net: fix rc7's __skb_datagram_iter() Hugh Dickins
2024-07-08  6:21 ` Sagi Grimberg
2024-07-08 14:46   ` [PATCH v2] " Hugh Dickins
2024-07-08 14:47     ` Sagi Grimberg
2024-07-10 15:36       ` [PATCH v3] " Hugh Dickins
2024-07-10 16:19         ` Paolo Abeni
2024-07-10 16:36           ` Hugh Dickins
2024-07-11 20:43         ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®