public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	David Ahern <dsahern@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Tom Herbert <therbert@google.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1 net 2/2] fou: Don't allow 0 for FOU_ATTR_IPPROTO.
Date: Tue, 13 Jan 2026 19:11:22 -0800	[thread overview]
Message-ID: <20260113191122.1d0f3ec4@kernel.org> (raw)
In-Reply-To: <20260112200736.1884171-3-kuniyu@google.com>

On Mon, 12 Jan 2026 20:06:36 +0000 Kuniyuki Iwashima wrote:
> fou_udp_recv() has the same problem mentioned in the previous
> patch.
> 
> If FOU_ATTR_IPPROTO is set to 0, skb is not freed by
> fou_udp_recv() nor "resubmit"-ted in ip_protocol_deliver_rcu().
> 
> Let's forbid 0 for FOU_ATTR_IPPROTO.
> 
> Fixes: 23461551c0062 ("fou: Support for foo-over-udp RX path")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> ---
>  net/ipv4/fou_nl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
> index 7a99639204b16..0dec9da1bff46 100644
> --- a/net/ipv4/fou_nl.c
> +++ b/net/ipv4/fou_nl.c
> @@ -15,7 +15,7 @@
>  const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = {
>  	[FOU_ATTR_PORT] = { .type = NLA_BE16, },
>  	[FOU_ATTR_AF] = { .type = NLA_U8, },
> -	[FOU_ATTR_IPPROTO] = { .type = NLA_U8, },
> +	[FOU_ATTR_IPPROTO] = { .type = NLA_U8, .min = 1 },
>  	[FOU_ATTR_TYPE] = { .type = NLA_U8, },
>  	[FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, },
>  	[FOU_ATTR_LOCAL_V4] = { .type = NLA_U32, },

This code is generated, please use :

diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml
index 8e7974ec453f..331f1b342b3a 100644
--- a/Documentation/netlink/specs/fou.yaml
+++ b/Documentation/netlink/specs/fou.yaml
@@ -39,6 +39,8 @@ kernel-policy: global
       -
         name: ipproto
         type: u8
+        checks:
+          min: 1
       -
         name: type
         type: u8
diff --git a/net/ipv4/fou_nl.c b/net/ipv4/fou_nl.c
index 7a99639204b1..309d5ba983d0 100644
--- a/net/ipv4/fou_nl.c
+++ b/net/ipv4/fou_nl.c
@@ -15,7 +15,7 @@
 const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX + 1] = {
 	[FOU_ATTR_PORT] = { .type = NLA_BE16, },
 	[FOU_ATTR_AF] = { .type = NLA_U8, },
-	[FOU_ATTR_IPPROTO] = { .type = NLA_U8, },
+	[FOU_ATTR_IPPROTO] = NLA_POLICY_MIN(NLA_U8, 1),
 	[FOU_ATTR_TYPE] = { .type = NLA_U8, },
 	[FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, },
 	[FOU_ATTR_LOCAL_V4] = { .type = NLA_U32, },

  parent reply	other threads:[~2026-01-14  3:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 20:06 [PATCH v1 net 0/2] fou/gue: Fix skb memleak with inner protocol 0 Kuniyuki Iwashima
2026-01-12 20:06 ` [PATCH v1 net 1/2] gue: Fix skb memleak with inner IP " Kuniyuki Iwashima
2026-01-12 20:27   ` Eric Dumazet
2026-01-12 20:06 ` [PATCH v1 net 2/2] fou: Don't allow 0 for FOU_ATTR_IPPROTO Kuniyuki Iwashima
2026-01-12 20:25   ` Eric Dumazet
2026-01-14  3:11   ` Jakub Kicinski [this message]
2026-01-14  7:15     ` Kuniyuki Iwashima
2026-01-15  3:40       ` Jakub Kicinski
2026-01-15  7:43         ` Kuniyuki Iwashima

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=20260113191122.1d0f3ec4@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=therbert@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