Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C56F404BDA; Tue, 21 Jul 2026 17:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655009; cv=none; b=EIOGM2Ws7R3pq0+LplsdIcuRNVTy/8Ris2jYTfHj1v4rcg4j2GbbZDyOE4Jg6bS/9YI+iayx7apTyOdHfl5eTM+6r5L8Zrg8Mxr7bhIwC2Kh1HcPXc4gJryUyKg2MLTMbSiJv+16xNuu3is575HClYCq8lHyFNWJmXi0e7bOmH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655009; c=relaxed/simple; bh=UDIVNLKv9s9Q33MVjb07OxhvclyGPsE2N3NZZ5rFTmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QW2d+5KDx1J+ZXknbscn7jSfEEB4/uHzHLrolRQDQEvjXzlt0SwkxdJebYhMXeD6Jl9ANxsNet9BeCXsiv5/sNulKA8hqGDOXLhVXj7FSh7IZ3QIYqM4Ng0FrSyXex0Lpi6Ei2wgMYMsOKhNUa2kmFU55HrDBpyTnvvFLGi1bYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SGL5NVwE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SGL5NVwE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A328E1F000E9; Tue, 21 Jul 2026 17:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784655008; bh=JtNFTr5kQZRUyCLzBmf35pwRqudYWC13vJ77lT0yqNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SGL5NVwEDXXWbvtNZFfcB2xOt163YiT0wbe7gT4ygtX8hXtUqiVQMVbiM/I8d+Z3m fnCyAoHleoTIBQobeERW0AAxPIp1ZYtXhXUxwUT7a/HkbFZr7cj8ltl4Evwwut7dIM zDq/QGQTjSe3D25cjxHD836Aphv8ERbi6MMkqNCs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiao Liang , Maoyi Xie , Kuniyuki Iwashima , Jakub Kicinski Subject: [PATCH 7.1 1920/2077] net: ip6_tunnel: require CAP_NET_ADMIN in the device netns for changelink Date: Tue, 21 Jul 2026 17:26:33 +0200 Message-ID: <20260721152638.000280239@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maoyi Xie commit 2496fa0b7d180b3ad356b514e7ff93bb14e6140a upstream. ip6_tnl_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 ip6_tnl_changelink() on rtnl_dev_link_net_capable() at its top, before any attribute is parsed. Reported-by: Xiao Liang Closes: https://lore.kernel.org/netdev/CABAhCOSzP1vaThGV35_VnsRCb=87_CPjPVsTHbq905k8A+BuUg@mail.gmail.com/ Fixes: 0bd8762824e7 ("ip6tnl: add x-netns support") Cc: stable@vger.kernel.org Signed-off-by: Maoyi Xie Reviewed-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20260612085941.3158249-5-maoyixie.tju@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_tunnel.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -2109,6 +2109,9 @@ static int ip6_tnl_changelink(struct net struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); struct ip_tunnel_encap ipencap; + if (!rtnl_dev_link_net_capable(dev, net)) + return -EPERM; + if (dev == ip6n->fb_tnl_dev) { if (ip_tunnel_netlink_encap_parms(data, &ipencap)) { /* iproute2 always sets TUNNEL_ENCAP_FLAG_CSUM6, so