From: <zhaoping.shu@mediatek.com>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <horms@kernel.org>, <ncardwell@google.com>,
<kuniyu@google.com>, <matthias.bgg@gmail.com>,
<angelogioacchino.delregno@collabora.com>, <willemb@google.com>,
<alice@isovalent.com>, <sd@queasysnail.net>,
<eilaimemedsnaimel@gmail.com>, <imv4bel@gmail.com>,
<hw.he@mediatek.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>
Cc: <haijun.liu@mediatek.com>, <xiayu.zhang@mediatek.com>,
<lambert.wang@mediatek.com>, <Iven.Yang@mediatek.com>,
Zhaoping Shu <zhaoping.shu@mediatek.com>
Subject: [PATCH net v2] net: gro: avoid nesting TCP GSO skbs in skb_gro_receive_list()
Date: Thu, 23 Jul 2026 17:16:01 +0800 [thread overview]
Message-ID: <20260723091601.72103-1-zhaoping.shu@mediatek.com> (raw)
From: HW He <hw.he@mediatek.com>
On devices that support both NETIF_F_GRO_HW and NETIF_F_GRO_FRAGLIST,
the hardware or driver may deliver packets that have already been
aggregated into a TCP GSO skb with frags[]. GRO may then
aggregate the skb again in skb_gro_receive_list().
This can create a nested GSO skb, which is not handled correctly by the
later GSO segmentation paths. When the skb is segmented by
skb_segment_list(), it not be fully restored to the original packets.
Avoid this by setting NAPI_GRO_CB(skb)->flush for GSO skbs before
aggregation.
Signed-off-by: HW He <hw.he@mediatek.com>
Signed-off-by: Zhaoping Shu <zhaoping.shu@mediatek.com>
---
v2: Take Antoine Tenart's suggestion
v1: https://lore.kernel.org/netdev/amB7wb1A2Oo2dv5d@kwain/
---
net/ipv4/tcp_offload.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index 3b1fdcd3cb29..c363434a5646 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -332,6 +332,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb,
flush |= skb->ip_summed != p->ip_summed;
flush |= skb->csum_level != p->csum_level;
flush |= NAPI_GRO_CB(p)->count >= 64;
+ NAPI_GRO_CB(skb)->flush |= skb_is_gso(skb);
skb_set_network_header(skb, skb_gro_receive_network_offset(skb));
if (flush || skb_gro_receive_list(p, skb))
--
2.17.0
next reply other threads:[~2026-07-23 9:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 9:16 zhaoping.shu [this message]
2026-07-23 13:39 ` [PATCH net v2] net: gro: avoid nesting TCP GSO skbs in skb_gro_receive_list() Jakub Kicinski
2026-07-23 14:02 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723091601.72103-1-zhaoping.shu@mediatek.com \
--to=zhaoping.shu@mediatek.com \
--cc=Iven.Yang@mediatek.com \
--cc=alice@isovalent.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eilaimemedsnaimel@gmail.com \
--cc=haijun.liu@mediatek.com \
--cc=horms@kernel.org \
--cc=hw.he@mediatek.com \
--cc=imv4bel@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=lambert.wang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sd@queasysnail.net \
--cc=willemb@google.com \
--cc=xiayu.zhang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox