From: sashiko-bot@kernel.org
To: "Eric Dumazet" <edumazet@kernel.org>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH net v3 2/8] net: virtio: do not use dev->type to find the outer L3 header
Date: Fri, 06 Nov 2026 08:16:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-201039@kernel.org> (raw)
In-Reply-To: <20261105115715.1466924-3-edumazet@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: virtio: outer_l3min includes ETH_HLEN in
virtio_net_hdr_tnl_to_skb()
--
commit b246747b62fc4e9502b5e1a6192ecf203f97d1f4
Author: Eric Dumazet <edumazet@kernel.org>
net: virtio: do not use dev->type to find the outer L3 header
This commit adds a has_eth parameter to virtio_net_hdr_tnl_to_skb() and
virtio_net_l3_start() so callers specify whether the frame begins with an
Ethernet header instead of relying on skb->dev->type.
Link: https://lore.kernel.org/netdev/179387332014.488856.9111956413610107951@kernel.org/
> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> index 357116c2a1489..b7b6b542f4763 100644
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
[ ... ]
> @@ -452,6 +450,7 @@ virtio_net_tnl_offsets_ok(struct sk_buff *skb, bool outer_isv6,
> static inline int
> virtio_net_hdr_tnl_to_skb(struct sk_buff *skb,
> const struct virtio_net_hdr_v1_hash_tunnel *vhdr,
> + bool has_eth,
> bool tnl_hdr_negotiated,
> bool tnl_csum_negotiated,
> bool little_endian)
> @@ -505,7 +504,7 @@ virtio_net_hdr_tnl_to_skb(struct sk_buff *skb,
> if (ret)
> return ret;
>
> - if (!virtio_net_tnl_offsets_ok(skb, outer_isv6, outer_th))
> + if (!virtio_net_tnl_offsets_ok(skb, has_eth, outer_isv6, outer_th))
> return -EINVAL;
[Severity: Medium]
When tun_get_user() processes an IFF_TUN device, it resets the network header
offset to 0 and calls tun_vnet_hdr_tnl_to_skb() -> virtio_net_hdr_tnl_to_skb()
with has_eth set to false.
However, earlier in virtio_net_hdr_tnl_to_skb(), outer_l3min still
unconditionally includes ETH_HLEN:
outer_l3min = ETH_HLEN + virtio_l3min(outer_isv6);
inner_th = __virtio16_to_cpu(little_endian, hdr->csum_start);
inner_nh = le16_to_cpu(vhdr->inner_nh_offset);
outer_th = le16_to_cpu(vhdr->outer_th_offset);
if (outer_th < outer_l3min ||
inner_nh < outer_th + sizeof(struct udphdr) ||
inner_th < inner_nh + inner_l3min)
return -EINVAL;
For an IFF_TUN packet without outer IPv4 options or IPv6 extension headers,
virtio_net_tnl_offsets_ok() -> virtio_net_l3_start() sets nhoff to 0, and
virtio_net_l4_start() computes thoff as 20 (IPv4) or 40 (IPv6), requiring
outer_th == thoff. Because outer_th < outer_l3min rejects outer_th < 34 for
IPv4 or outer_th < 54 for IPv6, won't valid UDP-tunneled GSO packets on
IFF_TUN devices be rejected with -EINVAL unless outer_l3min only adds
ETH_HLEN when has_eth is true?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261105115715.1466924-1-edumazet@kernel.org?part=2
next prev parent reply other threads:[~2026-11-06 8:16 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 11:57 [PATCH net v3 0/8] net: virtio: validate outer protocol of UDP tunnel GSO packets Eric Dumazet
2026-11-05 11:57 ` [PATCH net v3 1/8] " Eric Dumazet
2026-11-06 8:16 ` sashiko-bot
2026-11-08 23:01 ` netdev-bot+sashiko
2026-11-05 11:57 ` [PATCH net v3 2/8] net: virtio: do not use dev->type to find the outer L3 header Eric Dumazet
2026-11-06 4:18 ` Willem de Bruijn
2026-11-06 8:48 ` Eric Dumazet
2026-11-06 8:16 ` sashiko-bot [this message]
2026-11-06 8:50 ` Eric Dumazet
2026-11-06 9:27 ` Michael S. Tsirkin
2026-11-06 9:55 ` Eric Dumazet
2026-11-08 23:01 ` netdev-bot+sashiko
2026-11-05 11:57 ` [PATCH net v3 3/8] tun: clear stale skb->protocol of NAPI frags skbs Eric Dumazet
2026-11-06 4:21 ` Willem de Bruijn
2026-11-06 8:49 ` Eric Dumazet
2026-11-06 8:16 ` sashiko-bot
2026-11-08 23:01 ` netdev-bot+sashiko
2026-11-05 11:57 ` [PATCH net v3 4/8] selftests: net: tuntap: fix UDP checksum length in build_udp_packet_csum() Eric Dumazet
2026-11-06 8:16 ` sashiko-bot
2026-11-05 11:57 ` [PATCH net v3 5/8] selftests: net: tun: test outer protocol of UDP tunnel GSO packets Eric Dumazet
2026-11-06 8:16 ` sashiko-bot
2026-11-05 11:57 ` [PATCH net v3 6/8] selftests: net: tun: test UDP tunnel GSO on retyped devices Eric Dumazet
2026-11-06 4:25 ` Willem de Bruijn
2026-11-06 8:16 ` sashiko-bot
2026-11-08 23:02 ` netdev-bot+sashiko
2026-11-05 11:57 ` [PATCH net v3 7/8] selftests: net: tun: test more outer header mismatches of UDP tunnel GSO Eric Dumazet
2026-11-06 8:16 ` sashiko-bot
2026-11-06 8:51 ` Eric Dumazet
2026-11-08 23:02 ` netdev-bot+sashiko
2026-11-05 11:57 ` [PATCH net v3 8/8] selftests: net: tuntap: write UDP tunnel offsets in little endian Eric Dumazet
2026-11-06 8:16 ` sashiko-bot
2026-11-06 8:52 ` Eric Dumazet
2026-11-08 23:02 ` netdev-bot+sashiko
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=sashiko-outbox-201039@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/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