[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zg2B9iFLlADuzlBs@hog>
Date: Wed, 3 Apr 2024 18:21:10 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, eric.dumazet@...il.com,
syzbot+9ee20ec1de7b3168db09@...kaller.appspotmail.com,
Phillip Potter <phil@...lpotter.co.uk>
Subject: Re: [PATCH v2 net] geneve: fix header validation in
geneve[6]_xmit_skb
2024-04-03, 15:30:17 +0000, Eric Dumazet wrote:
> +static inline bool skb_vlan_inet_prepare(struct sk_buff *skb)
> +{
> + int nhlen, maclen;
> + __be16 type;
> +
> + /* Essentially this is skb_protocol(skb, true)
> + * And we get MAC len.
> + */
> + type = __vlan_get_protocol(skb, skb->protocol, &maclen);
> +
> + switch (type) {
> +#if IS_ENABLED(CONFIG_IPV6)
> + case htons(ETH_P_IPV6):
> + nhlen = sizeof(struct ipv6hdr);
> + break;
> +#endif
> + case htons(ETH_P_IP):
> + nhlen = sizeof(struct iphdr);
> + break;
> +
> + default:
> + nhlen = 0;
> + }
> + /* For ETH_P_IPV6/ETH_P_IP we make sure to pull
> + * a base network header in skb->head.
> + */
> + if (pskb_may_pull(skb, maclen + nhlen))
Missing ! in the condition.
Otherwise looks ok to me.
> + return false;
> +
> + skb_set_network_header(skb, maclen);
> + return true;
> +}
--
Sabrina
Powered by blists - more mailing lists