Re: [PATCH net 1/2] udp: restore outer transport header after tunnel GRO
From: netdev-bot+sashiko
Date: Mon Nov 16 2026 - 08:50:58 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch fixes only one producer: udp_gro_complete().
--
udp: restore outer transport header after tunnel GRO
This patch changes udp_gro_complete() so that skb->transport_header points
back at the outer UDP header (nhoff) after the inner gro_complete()
callback succeeds. Without that, the virtio tunnel exporter reports the
inner transport offset as outer_th_offset, and the receiving TAP rejects
the aggregate.
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index b77ae2f00c626..1a1d1a125d23e 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
> @@ -948,6 +948,8 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff,
> skb->encapsulation = 1;
> err = udp_sk(sk)->gro_complete(sk, skb,
> nhoff + sizeof(struct udphdr));
> + if (!err)
> + skb_set_transport_header(skb, nhoff);
[Severity: High]
The commit message describes the problem in general terms:
"UDP tunnel GRO can produce invalid virtio tunnel headers, causing
virtio-net to drop whole aggregates."
The fix only covers aggregates that reach udp_gro_complete(). Can
UDP-tunnel GSO skbs that never pass through gro_complete() still reach
virtio_net_hdr_tnl_from_skb() with the same bad offsets?
The HW-GRO paths in bnxt (bnxt_gro_func_5731x() with bnxt_gro_tunnel())
and bnge (bnge_gro_func() with bnge_gro_tunnel()) build aggregates with
gso_type set to SKB_GSO_TCPV4/6 plus SKB_GSO_UDP_TUNNEL[_CSUM]. These
aggregates also have:
- transport_header on the inner TCP header
- skb->encapsulation never set
- inner_network_header never set
For example, in bnxt_gro_tunnel():
if (uh) {
if (uh->check)
skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL_CSUM;
else
skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL;
}
dev_gro_receive() accepts these TCP-GSO skbs into software GRO. However,
tcp_gro_receive() sets NAPI_GRO_CB(skb)->flush when len !=
count * gso_size, or when the header has PSH/URG/RST/SYN/FIN set. Both
cases are common at the end of a bulk TCP burst.
A flush is also forced when udp_gro_receive() finds no matching tunnel
socket, or when the outer tot_len check in inet_gro_receive() fails. In
each of these cases, dev_gro_receive() takes this path:
if (NAPI_GRO_CB(skb)->flush)
goto normal;
and neither gro_complete() nor udp_gro_complete() runs.
If the skb is then bridged to a TAP that negotiated TUN_F_UDP_TUNNEL_GSO,
virtio_net_hdr_tnl_from_skb() does:
inner_nh = skb->inner_network_header - skb_headroom(skb);
outer_th = skb->transport_header - skb_headroom(skb);
That gives outer_th_offset equal to the inner TCP offset and
inner_nh_offset equal to (u16)(0 - headroom). On the peer side,
virtio_net_hdr_tnl_to_skb() then fails its inner_th < inner_nh +
inner_l3min check and returns -EINVAL. That is the same dropped-aggregate
symptom described in the commit message.
These aggregates also cannot be re-segmented in software.
udp4_ufo_fragment() returns -EINVAL when encapsulation is 0 and neither
SKB_GSO_UDP nor SKB_GSO_UDP_L4 is set. That suggests the root cause for
this path is in the drivers.
The change itself looks correct. Should it be extended to cover this
path? One option would be to have the bnxt/bnge HW-GRO paths set
encapsulation and the inner mac/network/transport headers, and leave
transport_header on the outer UDP header. Otherwise, could the commit
message be narrowed to the software GRO completion path?
Separately, would it make sense for virtio_net_hdr_tnl_from_skb() to
reject tunnel-GSO skbs with !skb->encapsulation rather than emit these
offsets?
> } else {
> err = udp_gro_complete_segment(skb);
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112030708.1915665-1-bryon%40fryer.io