]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
genetlink: apply reject policy for split ops on the dispatch path
authorJakub Kicinski <kuba@kernel.org>
Wed, 11 Mar 2026 03:28:37 +0000 (20:28 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Mar 2026 01:02:13 +0000 (18:02 -0700)
Commit 4fa86555d1cd ("genetlink: piggy back on resv_op to default to
a reject policy") added genl_policy_reject_all to ensure that ops
without an explicit policy reject all attributes rather than silently
accepting them. This change was applied to net.

When split ops were later introduced in net-next in
commit b8fd60c36a44 ("genetlink: allow families to use split ops directly"),
genl_op_fill_in_reject_policy_split() was added and called from
genl_op_from_split() (used for policy dumping and registration).
However, genl_get_cmd_split(), which is called for incoming messages,
copies split_ops entries as-is without applying the reject policy.
This means that split ops without policy accept all inputs.

This looks like an omission / mistake made when splitting the changes
between net and net-next. Let's try to re-introduce the checking.
Not considering this a fix given the regression potential.
If anyone reports issues we should probably fill in fake policies
for specific ops rather than reverting this.

Link: https://patch.msgid.link/20260311032839.417748-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/netlink/genetlink.c

index c00f0586c8d6550b4b0a61c22de7da3d5b078848..d251d894afd468b7a8fba11e4fd5760ede55ea5e 100644 (file)
@@ -244,6 +244,7 @@ genl_get_cmd_split(u32 cmd, u8 flag, const struct genl_family *family,
                if (family->split_ops[i].cmd == cmd &&
                    family->split_ops[i].flags & flag) {
                        *op = family->split_ops[i];
+                       genl_op_fill_in_reject_policy_split(family, op);
                        return 0;
                }