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 4405E3264FF; Tue, 21 Jul 2026 18:38:56 +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=1784659138; cv=none; b=Rn1/RVEuFtAUqC6WWe1ugbsec1Xf9OdMRrOuRB0H6mdPAeNI5T1DLNFPAH36FUUleFkaeWio6VsrF/CBt3O74OmN3Y2vbFE3JBAkrkSk6lzPRvj0o2X+9//hT8DM8h7HrYtkNI9F84xcxxvidOHMF6c/NCJHtp7OwXYzDj6kabg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784659138; c=relaxed/simple; bh=ruBqQjnihHndw+a9sdIZunAX+AB6rS7Sz4bA+wkM5XQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U0ntSM4H7lW5lkUzGHyYvhzLKIac0tdgAjNCFOiXOQF6IzZW8Puz1a9x2l+cykPixX8Sf+Y3KjWtw9j72brmPjKd8rDByv9kzLEAO3iP1JtKRggk8uDtTFggSZXU/p/nh7LFChBiAg7ZRWA0WZwyCn9qy+EzcV2m6mMO1lrKaRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MyMd9o5Y; 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="MyMd9o5Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A99391F000E9; Tue, 21 Jul 2026 18:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784659136; bh=JeSWJDxVtabTHgzpVIMxp3aalYNhCXKfGj6YrSXivH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MyMd9o5YRfufeE0zrW+Lexwu/B3F/iUsBFr1V6lbm633NP4Y1nLzPBrIakDjx4yJM Th03wZfxz4p8IKvd0D3Cdad2OWr3LmiAvifHf+1ytoDg+vjNwXiMKotbf+5Hd8oXoX yhEqpOfFuYUN90z8ioa78m18LRzRyJyxmGTtFAnk= 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.18 1408/1611] net: ipip: require CAP_NET_ADMIN in the device netns for changelink Date: Tue, 21 Jul 2026 17:25:24 +0200 Message-ID: <20260721152547.112604764@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maoyi Xie commit 8211a26324667980a463c069469a818e71207e02 upstream. ipip_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 ipip_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: 6c742e714d8c ("ipip: 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-3-maoyixie.tju@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ipip.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -469,6 +469,9 @@ static int ipip_changelink(struct net_de bool collect_md; __u32 fwmark = t->fwmark; + if (!rtnl_dev_link_net_capable(dev, t->net)) + return -EPERM; + if (ip_tunnel_netlink_encap_parms(data, &ipencap)) { int err = ip_tunnel_encap_setup(t, &ipencap);