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

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®