All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot+9ee20ec1de7b3168db09@syzkaller.appspotmail.com,
	Phillip Potter <phil@philpotter.co.uk>
Subject: Re: [PATCH v2 net] geneve: fix header validation in geneve[6]_xmit_skb
Date: Wed, 3 Apr 2024 18:21:10 +0200	[thread overview]
Message-ID: <Zg2B9iFLlADuzlBs@hog> (raw)
In-Reply-To: <20240403153017.426490-1-edumazet@google.com>

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


      reply	other threads:[~2024-04-03 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 15:30 [PATCH v2 net] geneve: fix header validation in geneve[6]_xmit_skb Eric Dumazet
2024-04-03 16:21 ` Sabrina Dubroca [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=Zg2B9iFLlADuzlBs@hog \
    --to=sd@queasysnail.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phil@philpotter.co.uk \
    --cc=syzbot+9ee20ec1de7b3168db09@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.