* [PATCH net] geneve: don't announce options that are not geneve options
@ 2026-11-27 6:47 Henry Martin
2026-11-27 6:53 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Henry Martin @ 2026-11-27 6:47 UTC (permalink / raw)
To: Andrew Lunn, Pieter Jansen van Vuuren, David S . Miller,
Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, Henry Martin, stable
geneve_build_header() announces info->options_len in the wire header
unconditionally, but only copies the option bytes when the tunnel
metadata carries the geneve option flag. With metadata of another
tunnel type (vxlan, erspan), set for example by a tc tunnel_key action,
the announced option space is never written: the packet goes out with
whatever bytes __skb_push() left in the skb headroom, and the peer can
read 4 or 12 stale kernel bytes per packet, repeatedly.
Only announce and emit options that are actually geneve options. Other
metadata is dropped from the wire header instead of being replaced by
stale headroom bytes: the option space sizing and the GRO hint offset
now both follow the same condition as the copy.
This issue was discovered by Tencent CodeBuddy Security.
Cc: stable@vger.kernel.org
Fixes: 256c87c17c53 ("net: check tunnel option type in tunnel flags")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
drivers/net/geneve.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 0ab729f055ea0..dd1734b82af59 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1231,7 +1231,7 @@ static void geneve_build_header(struct genevehdr *geneveh,
__be16 inner_proto)
{
geneveh->ver = GENEVE_VER;
- geneveh->opt_len = info->options_len / 4;
+ geneveh->opt_len = 0;
geneveh->oam = test_bit(IP_TUNNEL_OAM_BIT, info->key.tun_flags);
geneveh->critical = test_bit(IP_TUNNEL_CRIT_OPT_BIT,
info->key.tun_flags);
@@ -1240,8 +1240,15 @@ static void geneve_build_header(struct genevehdr *geneveh,
geneveh->proto_type = inner_proto;
geneveh->rsvd2 = 0;
- if (test_bit(IP_TUNNEL_GENEVE_OPT_BIT, info->key.tun_flags))
+ /* Only announce and copy options that are actually geneve
+ * options. Metadata of another tunnel type (vxlan, erspan)
+ * must not go on the wire: there is nothing to copy it from,
+ * and the option space would carry stale headroom bytes.
+ */
+ if (test_bit(IP_TUNNEL_GENEVE_OPT_BIT, info->key.tun_flags)) {
+ geneveh->opt_len = info->options_len / 4;
ip_tunnel_info_opts_get(geneveh->options, info);
+ }
}
static int geneve_build_gro_hint_opt(const struct geneve_dev *geneve,
@@ -1336,7 +1343,10 @@ static int geneve_build_skb(struct dst_entry *dst, struct sk_buff *skb,
skb_reset_mac_header(skb);
skb_scrub_packet(skb, xnet);
- opt_size = info->options_len + cb->gro_hint_len;
+ if (test_bit(IP_TUNNEL_GENEVE_OPT_BIT, info->key.tun_flags))
+ opt_size = info->options_len + cb->gro_hint_len;
+ else
+ opt_size = cb->gro_hint_len;
min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len +
GENEVE_BASE_HLEN + opt_size + ip_hdr_len;
err = skb_cow_head(skb, min_headroom);
@@ -1353,7 +1363,8 @@ static int geneve_build_skb(struct dst_entry *dst, struct sk_buff *skb,
geneve_build_header(gnvh, info, inner_proto);
if (cb->gro_hint_len)
- geneve_put_gro_hint_opt(gnvh, info->options_len, &cb->gro_hint);
+ geneve_put_gro_hint_opt(gnvh, opt_size - cb->gro_hint_len,
+ &cb->gro_hint);
udp_tunnel_set_inner_protocol(skb, double_encap, inner_proto);
return 0;
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] geneve: don't announce options that are not geneve options
2026-11-27 6:47 [PATCH net] geneve: don't announce options that are not geneve options Henry Martin
@ 2026-11-27 6:53 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-27 6:53 UTC (permalink / raw)
To: Henry Martin
Cc: Andrew Lunn, Pieter Jansen van Vuuren, David S . Miller,
Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev, stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 6:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 6:47 [PATCH net] geneve: don't announce options that are not geneve options Henry Martin
2026-11-27 6:53 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox