From mboxrd@z Thu Jan 1 00:00:00 1970 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 E88FA3B9930; Tue, 21 Jul 2026 21:45:11 +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=1784670313; cv=none; b=sN5DYf1B6gx1VWSwsDE/293nNTjtoLHxgQlAY3DzBvyxzimroPf6/5LNd3Uy/8GBFLXF9Obrj1zjzyPuJPLp58MGHiLi1a2jI/s/cWauVdCr4I/HuUpC+LiOUttfJow1C0CEcv6E1NhMSFpMQWNVTLPwiAqell22kA3kaQKfcXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670313; c=relaxed/simple; bh=YFYi/FLnPop1yGnZrzkpoxCkSIJzgY+MEDOdOoaIPJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dhOunSMuNSDF3eIVAmklNYaXOzRYNsOpYjRnTbdW5x+wuu1dTYW04eWdWKV5Mbe0ga/P6OSXwDnPk4r5bp4fN1rWc/UYnRNo45CujFqfCr6oDz1mJ2+oPdUrX4sPV0F0kxME7MBwCi7kfgAtVvY8xGSnHIDcrDFIOOkoIrlv1AM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oZUR/jWx; 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="oZUR/jWx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574A31F00A3A; Tue, 21 Jul 2026 21:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670311; bh=lTOT+8u/6rleqfwim2i23Dk4Y4jy5BNwXe/mgQi3i64=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oZUR/jWxY+kvgnmG6Mgzmlwd7UzdKraaFB4O7sM1V9gcv3weQZUVURY0Aa8Ip2WT6 J0j/lRKiVz/ws1KnoRqgG8T2kKuDtlpvjxN0VWELR8prwDQyG1iLk5Dy8SEBMbbMeD 6odZSIRt4xMeKSoUlx2fzZBwviihDRunmQCdsfK4= 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.1 0883/1067] net: ip6_gre: require CAP_NET_ADMIN in the device netns for changelink Date: Tue, 21 Jul 2026 17:24:44 +0200 Message-ID: <20260721152444.283041433@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@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.1-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 @@ -2112,6 +2112,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); @@ -2326,6 +2329,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))