]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: devmem: allow bind-rx from non-init user namespaces
authorBobby Eshleman <bobbyeshleman@meta.com>
Wed, 3 Jun 2026 01:37:31 +0000 (18:37 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Jun 2026 01:10:31 +0000 (18:10 -0700)
NETDEV_CMD_BIND_RX is currently GENL_ADMIN_PERM, which checks
CAP_NET_ADMIN against init userns. With recent container/netkit/ns
support for devmem, other userns/netns use cases come online and require
bind-rx to allow CAP_NET_ADMIN in non-init user ns as well.

Switch the flag to GENL_UNS_ADMIN_PERM to allow bind-rx for
CAP_NET_ADMIN in the netns's owning userns as well.

Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260602-nl-prov-v2-1-ad721142c641@meta.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/netlink/specs/netdev.yaml
net/core/netdev-genl-gen.c

index a1f4c5a561e9d1f344e69b55517681dc76af05e5..49862b666d7dabed891d061d6848f2115aad8a5b 100644 (file)
@@ -798,7 +798,7 @@ operations:
       name: bind-rx
       doc: Bind dmabuf to netdev
       attribute-set: dmabuf
-      flags: [admin-perm]
+      flags: [uns-admin-perm]
       do:
         request:
           attributes:
index c7e138bfe34574559c0c1460573601b27b1dfcf1..d18c89b5a6c75929de922cd8a41795c5540897a8 100644 (file)
@@ -220,7 +220,7 @@ static const struct genl_split_ops netdev_nl_ops[] = {
                .doit           = netdev_nl_bind_rx_doit,
                .policy         = netdev_bind_rx_nl_policy,
                .maxattr        = NETDEV_A_DMABUF_FD,
-               .flags          = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
+               .flags          = GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,
        },
        {
                .cmd            = NETDEV_CMD_NAPI_SET,