netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] gro_cells: Avoid packet re-ordering for cloned skbs
@ 2025-01-09 14:27 Thomas Bogendoerfer
  2025-01-09 14:56 ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Bogendoerfer @ 2025-01-09 14:27 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, linux-kernel

gro_cells_receive() passes a cloned skb directly up the stack and
could cause re-ordering against segments still in GRO. To avoid
this copy the skb and let GRO do it's work.

Fixes: c9e6bc644e55 ("net: add gro_cells infrastructure")
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 net/core/gro_cells.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
index ff8e5b64bf6b..2f8d688f9d82 100644
--- a/net/core/gro_cells.c
+++ b/net/core/gro_cells.c
@@ -20,11 +20,20 @@ int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
 	if (unlikely(!(dev->flags & IFF_UP)))
 		goto drop;
 
-	if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) {
+	if (!gcells->cells || netif_elide_gro(dev)) {
+netif_rx:
 		res = netif_rx(skb);
 		goto unlock;
 	}
+	if (skb_cloned(skb)) {
+		struct sk_buff *n;
 
+		n = skb_copy(skb, GFP_KERNEL);
+		if (!n)
+			goto netif_rx;
+		kfree_skb(skb);
+		skb = n;
+	}
 	cell = this_cpu_ptr(gcells->cells);
 
 	if (skb_queue_len(&cell->napi_skbs) > READ_ONCE(net_hotdata.max_backlog)) {
-- 
2.35.3


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

end of thread, other threads:[~2025-01-21 11:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-09 14:27 [PATCH net] gro_cells: Avoid packet re-ordering for cloned skbs Thomas Bogendoerfer
2025-01-09 14:56 ` Eric Dumazet
2025-01-13 11:28   ` Thomas Bogendoerfer
2025-01-13 12:55     ` Eric Dumazet
2025-01-13 13:33       ` Alexander Lobakin
2025-01-20 14:31       ` Thomas Bogendoerfer
2025-01-20 14:55         ` Eric Dumazet
2025-01-21 11:51           ` Thomas Bogendoerfer

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).