From: Ido Schimmel <idosch@nvidia.com>
To: Kyuwon Cho <kyuwoncho18@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>, Xin Long <lucien.xin@gmail.com>,
Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH net] ip6_gre: return the full header length from ip6gre_header()
Date: Thu, 26 Nov 2026 17:27:46 +0200 [thread overview]
Message-ID: <20261126152746.GA861118@shredder> (raw)
In-Reply-To: <179553307366.1670514.6802805102726706751@gmail.com>
On Wed, Nov 25, 2026 at 11:04:42AM +0900, Kyuwon Cho wrote:
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index b5d6ed8f0c36..9b30fb2f4bcf 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -1397,6 +1397,7 @@ static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
> ip6_flow_hdr(ipv6h, 0, ip6_make_flowlabel(dev_net(dev), skb,
> t->fl.u.ip6.flowlabel,
> true, &t->fl.u.ip6));
> + ipv6h->payload_len = htons(t->hlen + len);
> ipv6h->hop_limit = t->parms.hop_limit;
> ipv6h->nexthdr = NEXTHDR_GRE;
> ipv6h->saddr = t->parms.laddr;
> @@ -1415,9 +1416,9 @@ static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
> if (daddr)
> memcpy(&ipv6h->daddr, daddr, sizeof(struct in6_addr));
> if (!ipv6_addr_any(&ipv6h->daddr))
> - return t->hlen;
> + return needed;
>
> - return -t->hlen;
> + return -needed;
> }
There's another info leak in this function. It only initializes the base
GRE header. The optional parts (e.g., key, sequence number) are left
uninitialized.
Before this patch the payload was likely written over these bytes, but
now they remain uninitialized and leak. I suggest a memset(ipv6h, 0,
needed) after the skb_push(). ipgre_header() has the same problem.
Please wait for the AI review before sending v2. As I see it, it should
be three patches:
1. Add missing memset() in ipgre_header().
2. Add missing memset() in ip6gre_header().
3. The current patch.
And use the appropriate Fixes tag for each.
prev parent reply other threads:[~2026-11-26 15:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 2:04 [PATCH net] ip6_gre: return the full header length from ip6gre_header() Kyuwon Cho
2026-11-26 15:27 ` Ido Schimmel [this message]
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=20261126152746.GA861118@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kyuwoncho18@gmail.com \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.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