Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink
@ 2026-06-18  7:08 Maoyi Xie
  2026-06-18  8:25 ` Nicolas Dichtel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maoyi Xie @ 2026-06-18  7:08 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, Xiao Liang, Nicolas Dichtel,
	Kees Cook, netdev, linux-kernel, stable

ipip6_changelink() operates on at most two netns, dev_net(dev) and the
tunnel link netns t->net. They differ once the device is created in or
moved to a netns other than the one the request runs in. The rtnl
changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a
caller privileged there but not in t->net can rewrite a tunnel that
lives in t->net.

Gate ipip6_changelink() on rtnl_dev_link_net_capable() at its top,
before any attribute is parsed. sit was the one tunnel type not covered
by the recent series that added this check to the other changelink()
handlers.

Fixes: 5e6700b3bf98 ("sit: add support of x-netns")
Link: https://lore.kernel.org/netdev/20260612085941.3158249-1-maoyixie.tju@gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
---
 net/ipv6/sit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 64f0d1b..a38b24f 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1613,6 +1613,9 @@ static int ipip6_changelink(struct net_device *dev, struct nlattr *tb[],
 	__u32 fwmark = t->fwmark;
 	int err;
 
+	if (!rtnl_dev_link_net_capable(dev, net))
+		return -EPERM;
+
 	if (dev == sitn->fb_tunnel_dev)
 		return -EINVAL;
 
--
2.43.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink
  2026-06-18  7:08 [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink Maoyi Xie
@ 2026-06-18  8:25 ` Nicolas Dichtel
  2026-06-19 21:29 ` Kuniyuki Iwashima
  2026-06-21 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Dichtel @ 2026-06-18  8:25 UTC (permalink / raw)
  To: Maoyi Xie, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, Xiao Liang, Kees Cook, netdev,
	linux-kernel, stable

Le 18/06/2026 à 09:08, Maoyi Xie a écrit :
> ipip6_changelink() operates on at most two netns, dev_net(dev) and the
> tunnel link netns t->net. They differ once the device is created in or
> moved to a netns other than the one the request runs in. The rtnl
> changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a
> caller privileged there but not in t->net can rewrite a tunnel that
> lives in t->net.
> 
> Gate ipip6_changelink() on rtnl_dev_link_net_capable() at its top,
> before any attribute is parsed. sit was the one tunnel type not covered
> by the recent series that added this check to the other changelink()
> handlers.
> 
> Fixes: 5e6700b3bf98 ("sit: add support of x-netns")
> Link: https://lore.kernel.org/netdev/20260612085941.3158249-1-maoyixie.tju@gmail.com/
> Cc: stable@vger.kernel.org
> Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>

Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink
  2026-06-18  7:08 [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink Maoyi Xie
  2026-06-18  8:25 ` Nicolas Dichtel
@ 2026-06-19 21:29 ` Kuniyuki Iwashima
  2026-06-21 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-06-19 21:29 UTC (permalink / raw)
  To: Maoyi Xie
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Xiao Liang, Nicolas Dichtel, Kees Cook, netdev,
	linux-kernel, stable

On Thu, Jun 18, 2026 at 12:08 AM Maoyi Xie <maoyixie.tju@gmail.com> wrote:
>
> ipip6_changelink() operates on at most two netns, dev_net(dev) and the
> tunnel link netns t->net. They differ once the device is created in or
> moved to a netns other than the one the request runs in. The rtnl
> changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a
> caller privileged there but not in t->net can rewrite a tunnel that
> lives in t->net.
>
> Gate ipip6_changelink() on rtnl_dev_link_net_capable() at its top,
> before any attribute is parsed. sit was the one tunnel type not covered
> by the recent series that added this check to the other changelink()
> handlers.
>
> Fixes: 5e6700b3bf98 ("sit: add support of x-netns")
> Link: https://lore.kernel.org/netdev/20260612085941.3158249-1-maoyixie.tju@gmail.com/
> Cc: stable@vger.kernel.org
> Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink
  2026-06-18  7:08 [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink Maoyi Xie
  2026-06-18  8:25 ` Nicolas Dichtel
  2026-06-19 21:29 ` Kuniyuki Iwashima
@ 2026-06-21 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-21 22:20 UTC (permalink / raw)
  To: Maoyi Xie
  Cc: davem, edumazet, kuba, pabeni, horms, kuniyu, shaw.leon,
	nicolas.dichtel, kees, netdev, linux-kernel, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 18 Jun 2026 15:08:17 +0800 you wrote:
> ipip6_changelink() operates on at most two netns, dev_net(dev) and the
> tunnel link netns t->net. They differ once the device is created in or
> moved to a netns other than the one the request runs in. The rtnl
> changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a
> caller privileged there but not in t->net can rewrite a tunnel that
> lives in t->net.
> 
> [...]

Here is the summary with links:
  - [net] net: sit: require CAP_NET_ADMIN in the device netns for changelink
    https://git.kernel.org/netdev/net/c/27ccb68e7ccc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-21 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18  7:08 [PATCH net] net: sit: require CAP_NET_ADMIN in the device netns for changelink Maoyi Xie
2026-06-18  8:25 ` Nicolas Dichtel
2026-06-19 21:29 ` Kuniyuki Iwashima
2026-06-21 22:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox