summaryrefslogtreecommitdiff
path: root/include/linux/debugobjects.h
diff options
context:
space:
mode:
authorAamir Ahmed <elb12345@hotmail.co.uk>2026-09-11 22:33:10 +0100
committerJakub Kicinski <kuba@kernel.org>2026-09-16 17:24:52 -0700
commited502e4856856358b304d0c04f8e33364547d1d2 (patch)
treedacb2dc15ae35b63e88308aff9a432abad245b86 /include/linux/debugobjects.h
parent3c8abdbe345be37aedadddf931df214d706bb973 (diff)
macsec: require CAP_NET_ADMIN in the device netns for changelink
macsec_changelink() operates on two netns: dev_net(dev) and the netns of macsec->real_dev. They differ once the macsec device is created in or moved to a netns other than the one holding the real device. The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a caller privileged there but not in dev_net(real_dev) can reach real_dev's driver: - IFLA_MACSEC_OFFLOAD -> macsec_update_offload(), which calls ops->mdo_add_secy() / mdo_del_secy() on real_dev. - the tail "propagate to the device" block, which calls ops->mdo_upd_secy() on real_dev for any request against an already offloaded device that does not change the offload mode. This one needs no IFLA_MACSEC_OFFLOAD attribute at all. Gate both with rtnl_dev_link_net_capable(), as the tunnel, geneve, vxlan and macvlan handlers already do. It fires only when the request would reach real_dev: when IFLA_MACSEC_OFFLOAD asks for a mode other than the current one, or when the device is already offloaded. The local attributes of a non-offloaded device stay configurable from its own netns. The check is in the changelink handler rather than in macsec_update_offload(), because the mdo_upd_secy() propagation does not go through that function. Its other caller, macsec_upd_offload() for MACSEC_CMD_UPD_OFFLOAD, is GENL_ADMIN_PERM. The ndo and dellink paths that reach real_dev's driver as a side effect of operating the macsec device itself (open/stop, set_mac_address, dellink) are unchanged here. rtnl_dev_link_net_capable() was added by commit 8165f7ff57d9 ("net: ip_gre: require CAP_NET_ADMIN in the device netns for changelink"); a stable tree without it needs that first. Cc: stable+noautosel@kernel.org # high regression risk; local DoS by userns are a dime a dozen Fixes: 3cf3227a21d1 ("net: macsec: hardware offloading infrastructure") Cc: Antoine Tenart <atenart@kernel.org> Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk> Link: https://patch.msgid.link/AS8P251MB000176E827636EA185226908C8BE2@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions