Article View: linux.kernel.netdev
Article #8218[PATCH net] ip6_gre: fix changelink conflict checks for L2 tunnels
From: Xia Yan
Date: Wed, 28 Oct 2026 11:57
Date: Wed, 28 Oct 2026 11:57
65 lines
10994 bytes
10994 bytes
ip6gre_changelink_common() calls ip6gre_tunnel_locate(), which only
looks for ARPHRD_IP6GRE devices. The same changelink helper also handles
ip6gretap and ip6erspan devices.
This lets an L2 tunnel change its parameters to match another L2 tunnel,
since the duplicate check looks for an L3 device instead. Incoming
packets can then be delivered to the wrong interface. An L3 tunnel with
matching parameters can also make a valid L2 update fail with EEXIST.
Use ip6gre_tunnel_find() with dev->type, as the newlink paths do.
Found while comparing the duplicate checks in newlink and changelink.
Confirmed with ip link commands. For example, with an IPv6 underlay
named under already configured:
ip link add tap1 type ip6gretap local fd26:106::1 \
remote fd26:106::2 key 100 dev under
ip link add tap2 type ip6gretap local fd26:106::1 \
remote fd26:106::2 key 200 dev under
ip link set tap1 up
ip link set tap2 up
ip link set tap2 type ip6gretap key 100
Before the fix, the last command succeeds and received frames move from
tap1 to tap2. After the fix, it fails with EEXIST and tap2 is unchanged.
Tested with standalone namespace tests in UML, with three runs each for
ip6gretap and ip6erspan, and with L3 GRE IPv4/IPv6 traffic and normal
tunnel updates. Full x86_64 W=1 builds with adjusted configurations
completed before and after with no new diagnostics.
Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Cc: stable@vger.kernel.org
Signed-off-by: Xia Yan <yanxia@cmss.chinamobile.com>
---
Runtime and build tests used net 7076f684d513. The target file is
identical at the current base.
Kernel selftests were not run.
The allmodconfig- and allyesconfig-derived builds had WERROR,
KASAN and KCSAN off. The allyesconfig-derived build also had
KUNIT_ALL_TESTS, MCTP_TEST and MCTP_TRANSPORT_USBLIB_TEST off
to avoid an existing MCTP test assertion. olddefconfig dropped
IWLWIFI_KUNIT_TESTS when KUNIT_ALL_TESTS was disabled.
net/ipv6/ip6_gre.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index b5d6ed8f0c369..df490798355de 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -2055,7 +2055,7 @@ ip6gre_changelink_common(struct net_device *dev, struct nlattr *tb[],
ip6gre_netlink_parms(data, p_p);
- t = ip6gre_tunnel_locate(net, p_p, 0);
+ t = ip6gre_tunnel_find(net, p_p, dev->type);
if (t) {
if (t->dev != dev)
base-commit: 5d7f3375cd574fc83f0cd30839b21455c0e79ae2
Technical Details
Message-ID:
<20261028115710.27806-1-yanxia@cmss.chinamobile.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352838-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352838-linux-kernel-netdev=dewy.ru From: yanxia@cmss.chinamobile.com (Xia Yan) Newsgroups: linux.kernel.netdev Subject: [PATCH net] ip6_gre: fix changelink conflict checks for L2 tunnels Date: Wed, 28 Oct 2026 19:57:10 +0800 Organization: Usenet Network Message-ID: <20261028115710.27806-1-yanxia@cmss.chinamobile.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1763894"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FJ5wmFDl5mlkEuQwyHWPwhInsQc= sha256:E41KVWhHExY5o2NaDxmHTrSajLabOXQKZs/LqlvfTAk= sha1:sJZBJ4/+r7mgJZAN1LasbYnX53I= sha256:+P+ds6Yqhb9BTHu8WdfdApqmNujEVRRmnGljvS5vXzU= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 083E9125C35; Wed, 28 Oct 2026 14:58:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.75 X-Spam-Status: No, score=-2.75 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key) reason="fail (body has been altered)" header.d=cmss.chinamobile.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FvBaNXaFGXsT; Wed, 28 Oct 2026 14:58:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-352838-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 4FBAD125C34; Wed, 28 Oct 2026 14:58:43 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 94AEA2BE2D; Wed, 28 Oct 2026 11:57:53 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793188669; b=fkL5rMPARbGqick9cKdFgfj+T1AyDiCFD2MFULMGQvXhWle8BKGMvqWLfXNi2AZCyC2v w/y4jtXCma+Is8sBtHUH4X7QOHxIoaQOSFypoDxxTFI9XcGadTb275ux3lfkA8xfyzsI/ 8Rj5xOfN5Knr8oYSxNg+zK7kCfoDVSgj7EBpbwFfIQBE54PPi4ToYPU0r7pIe3pz6xuk/ 4yglReCB5ZgZfiASa5E5X0Jn5Kw9qNEJ0QzAzReXPO/n8xo5bpmfpd+auZCG8pJH13hlt mbDP61grmuqKbKAwxe/V4RWkh7dmpj7Zy5TZ6AYmGp84T+z80YRbru8UyDDER03vyIg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793188669; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo: X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG: Received:X-RM-TRANSID:From:To:Cc:Subject:Date:Message-ID:X-Mailer: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=dE3bjK6V6q7+0Kp3at70qUH5wNVpLQIy6nIGWt4NgU4=; b=F0DIsx6dSI2tDDcGZR/9QYU4ZXl2UYJjGzpEG4Vra4qJTOV2o/VAcOniCxJ1XpjrO+ub P+LRwm6NM8Ed76kVG737sHmZ5zhIsyXZUOQUnHtngIzu2vjuiOMkBUQkJnYORkAt4jNh2 GeqkWq0SS0ZQh2XwlJgghSG9y1LAV7lXyW7zsdJrPLQ6PUuyPQc/RZhY9BknnuI3QftI2 qFqRUWXMqUH/vzqtE2rYkYlv+JlluVYDyx+9+Wpw85/tyhq38nvpZY6JR/+7ihwFS5nob QCbBMhqgKhmXf/RIS1DgGkrbT2A34BHZ/G+j01kVtTFsbULprgEyZWZtORm0lesFgIQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=WqLjdv2z; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AB1A606A324; Wed, 28 Oct 2026 11:57:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=WqLjdv2z X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.151 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793188649; b=BLopQbroO85SFP2TwN1b+kWqKd+zhxV9O0Wx/GeXShQ+0P6UHUYf+v/mMI9QUuWd94HM oFDgzjhS7wLJe4j55W4wji1m52jkI+97+ovq25HfgtqQKMfRAwtXpIE/HR3U0gzbMmipu XcwPFMFR0cpHfCtE7J4BHj6/6rwX9DS6UwnRQmfVGp9v8oc/pdLqUGwkqWrHsUA75e4Xn zy5w4HtEo6ZnyTro5ojOSa+HZ53OIx0zIyodSxASEWv6SBBXWCnfMle9zP15x0mVVLPwC FuI1aBd4ZwacZZlSJqyTKIawx2x/ib+0+8HuiY/DpbTowQQFMzSquHliJ2rqLnO2Ibw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793188649; h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received: X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From: To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=dE3bjK6V6q7+0Kp3at70qUH5wNVpLQIy6nIGWt4NgU4=; b=2i4MvmvLGZqKRYL5DFXeFrwRbZXKGK/sgnIPOuQnCZEHa4HTGWYAG0V8SBwYXA+AvWTu MlVwFhgjTqHVaJCNW58SsQYo429kPdCVyMW7WYzzG8lrG20MZJyFgkKienAaTH+sHRNBI XudsbrW1YzGNoduxK+GbGTogQp31HchrNSbbXkVpf2JXOpOGl7slvEZOGdyZPWh5NUbKb zH3+KmfnjpV6nKg26ll7UdyjnUYiQAZbRrjrKn3mzqZ4UQJ6YiCGdM455/Qf7l3ExDEt9 rzf+egtsS33QQ4AkcCZEjtlPVdY9WW+6chrud/LOie9yuPyf+ohqXvw69P01fFLAAyA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=WqLjdv2z; arc=none smtp.remote-ip=111.22.67.151 X-Received: from cmccmta8.chinamobile.com (cmccmta8.chinamobile.com [111.22.67.151]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD00E606A31A; Wed, 28 Oct 2026 11:57:26 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AD00E606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmss.chinamobile.com; s=default; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=WqLjdv2zompj8IeLPNY5GQXZVtfO7iHJdcfU3VXaMtFA9w6GYUDqhOIoCs84LU+14+Q0gKEU7sDEc +krNQJ1Ud97ZlWRr5xNb8ER4vT1WBaTdPD60DYJ3mBkRifDLu6wi3YF4atGTD9QQp77JT1Au+CbGQG kE2BBfoITL5X+sSw= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app06-12006 (RichMail) with SMTP id 2ee66ae1e31fee2-2e1b7; Wed, 28 Oct 2026 19:57:25 +0800 (CST) X-RM-TRANSID: 2ee66ae1e31fee2-2e1b7 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-Received: from localhost.localdomain (unknown[112.23.104.16]) by rmsmtp-syy-appsvr04-12004 (RichMail) with SMTP id 2ee46ae1e3230cc-3de32; Wed, 28 Oct 2026 19:57:25 +0800 (CST) X-RM-TRANSID: 2ee46ae1e3230cc-3de32 X-Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, kuniyu@google.com, xeb@mail.ru, linux-kernel@vger.kernel.org, stable@vger.kernel.org, yana06070@163.com X-Mailer: git-send-email 2.43.0 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list