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 ADCCF43F4AF; Tue, 21 Jul 2026 22:25:05 +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=1784672706; cv=none; b=AH/Pk8/T+cud/ELklIN25cOiusKrJ80V338lZxORRdx6DAhpwhShSkQQo3Wv9h+3tH5SqB+n++1xkeHFMM74VUQw/OWvsS5im4f5Tm3OSMkemzqJegfPOJWo3NnlPHZ8f92C5dJyFZuW279Ks2E1tECP43QsO105OikwAd88c4I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784672706; c=relaxed/simple; bh=/pwiaz2Uy2ff3ViqTwhM2bapt9vNDpXxB0njWMTcA7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hxSa3dXrVzj692x6pXvj5830UQ7oHdIVgfqEGUzirhDAQ6rDzBiSvBM2/ceS9lDsg+87RMQoxsE9KRQvpr32N/QqvmWU5Aig0hrpdSsb1Iu4ZLiudc2VxPjtUt6o40snuADGf1TJ3wTR4K8dBa1fUF81ozw553isNB6El3vPiow= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=e/IX5J0K; 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="e/IX5J0K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1842A1F000E9; Tue, 21 Jul 2026 22:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784672705; bh=rF8Ac2h8IKQmMQZmgImmGoczEZPjdV82HR5DsKzK4I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e/IX5J0KIv/fQplWjLNR+L8EoohQrU17g6irMCnBj4aWX7IIMU0LAu4Gu85AOH9Lr 25LbzeozgF+epqKvpL0xVh5OPAhWQkbLDfqbJs8tT1YTmaQ0DLv1DLN2OoYXafsIej gAJTD3hrUY+qqQSaNi7ITQe39kxCn4t05gahqB1o= 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 5.15 683/843] net: ip6_gre: require CAP_NET_ADMIN in the device netns for changelink Date: Tue, 21 Jul 2026 17:25:18 +0200 Message-ID: <20260721152421.419245062@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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 5.15-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 @@ -2091,6 +2091,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); @@ -2305,6 +2308,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))