[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVpQUD9um80LD36osX4SuFk0BmkViHsPbKnFFXy=KtYoT_Z6g@mail.gmail.com>
Date: Tue, 13 Jan 2026 23:15:42 -0800
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>, David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Tom Herbert <therbert@...gle.com>, Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v1 net 2/2] fou: Don't allow 0 for FOU_ATTR_IPPROTO.
On Tue, Jan 13, 2026 at 7:11 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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@...gle.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, },
Oh thanks, I missed it's auto-generated.
Btw I needed the change below to generate the diff above
by "./tools/net/ynl/ynl-regen.sh -f". Maybe depending on
diff --git a/tools/net/ynl/ynl-regen.sh b/tools/net/ynl/ynl-regen.sh
index 81b4ecd891006..fda5fe24cfd47 100755
--- a/tools/net/ynl/ynl-regen.sh
+++ b/tools/net/ynl/ynl-regen.sh
@@ -29,9 +29,9 @@ for f in $files; do
continue
fi
- echo -e "\tGEN ${params[2]}\t$f"
- $TOOL --cmp-out --mode ${params[2]} --${params[3]} \
- --spec $KDIR/${params[0]} $args -o $f
+ echo -e "\tGEN ${params[5]}\t$f"
+ $TOOL --cmp-out --mode ${params[4]} --${params[5]} \
+ --spec $KDIR/${params[1]} $args -o $f
done
popd >>/dev/null
fwiw, $params were like
3- Documentation/netlink/specs/fou.yaml
4: YNL-GEN kernel source
--
3- Documentation/netlink/specs/fou.yaml
4: YNL-GEN kernel header
Powered by blists - more mailing lists