]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fou: Don't allow 0 for FOU_ATTR_IPPROTO.
authorKuniyuki Iwashima <kuniyu@google.com>
Thu, 15 Jan 2026 17:24:48 +0000 (17:24 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sun, 18 Jan 2026 00:00:24 +0000 (16:00 -0800)
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>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260115172533.693652-4-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/netlink/specs/fou.yaml
net/ipv4/fou_nl.c

index 8e7974ec453fca1f975c3431da081ce2d9f34223..331f1b342b3adbcbbae6af1261624fda3ea5f9ff 100644 (file)
@@ -39,6 +39,8 @@ attribute-sets:
       -
         name: ipproto
         type: u8
+        checks:
+          min: 1
       -
         name: type
         type: u8
index 7a99639204b16bc35afc50e16eeb225664a99294..309d5ba983d04e191c4bfd72c0266fd536824535 100644 (file)
@@ -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, },