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 6909446F4A1; Tue, 21 Jul 2026 20:00:53 +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=1784664054; cv=none; b=WanRVQm8J/DxVgp9jHu3rpYGDKIElr4N4JJzxY2mgwYc7XO6nOgHWZln0r1xxmfN6FD0n2l70t7y7KHTfFpgVJiZ9ZsJGfFQCkZKhv9rwgHV3K2nNQ8VBY3M7rI5i85xf2Uw7sJrV4j5w1zKHpqHKTLUCHRDtoHKh6EtjZIWxJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784664054; c=relaxed/simple; bh=ELgObp3QZabJBbI2zwYgzvjqfrGFEFE2JR0yAzB895c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hUQ1tOAXwHPceUcQjqxQl23cCIO1Dmb2JpaJyiPp9FWwHmI8Znej5UOJyVlC2mP4B9/NVc6HdI08G41jQVRLxo7A7uUx5vnqmFC1FmeK0qZUeg9UsCKndwSDPw81nlgdQrZ/ixVwykO1SkGtgePyDAigX62a5VXtu96pGB799dY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a7YdxnA8; 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="a7YdxnA8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDA981F000E9; Tue, 21 Jul 2026 20:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784664053; bh=QsyE2p/oag5J5tFTzZngnM2RXI72AZFPz+Y4A2IyP7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a7YdxnA8dwR1f4W1rGQ0E2PsBK3DnUrqm/1iQBhmo41JT4NFfsDOmTVabcCowvKzV EppkCvt6af4F3Id/SVQnNiljNhBz7ZsY0thYZaolVi+Lqjc5J/kQa/zT0v/9qWNVbt 4KiFX+yHFM9yJyK2KtqsGUTZziAynOWmKohrYpwU= 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 6.12 1053/1276] net: ip6_gre: require CAP_NET_ADMIN in the device netns for changelink Date: Tue, 21 Jul 2026 17:24:56 +0200 Message-ID: <20260721152509.553124302@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maoyi Xie commit f00a50876d2818bd6dc86fa98b3ef360884c53c8 upstream. ip6gre_changelink() and ip6erspan_changelink() operate 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 both ops on rtnl_dev_link_net_capable() at their 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: 690afc165bb3 ("net: ip6_gre: fix moving ip6gre between namespaces") Cc: stable@vger.kernel.org Signed-off-by: Maoyi Xie Reviewed-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20260612085941.3158249-6-maoyixie.tju@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_gre.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -2083,6 +2083,9 @@ static int ip6gre_changelink(struct net_ struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id); struct __ip6_tnl_parm p; + if (!rtnl_dev_link_net_capable(dev, t->net)) + return -EPERM; + t = ip6gre_changelink_common(dev, tb, data, &p, extack); if (IS_ERR(t)) return PTR_ERR(t); @@ -2300,6 +2303,9 @@ static int ip6erspan_changelink(struct n struct __ip6_tnl_parm p; struct ip6gre_net *ign; + if (!rtnl_dev_link_net_capable(dev, t->net)) + return -EPERM; + ign = net_generic(t->net, ip6gre_net_id); t = ip6gre_changelink_common(dev, tb, data, &p, extack); if (IS_ERR(t))