Article View: linux.kernel.netdev
Article #9192[PATCH net 3/3 repost2] net/sched: sch_teql: reject qdiscs from another network namespace
From: Jamal Hadi Salim
Date: Sat, 31 Oct 2026 20:18
Date: Sat, 31 Oct 2026 20:18
89 lines
14073 bytes
14073 bytes
Reported by shaos <shawnq1@163.com> with a reproducer, which was
reproduced and verified in our test environment.
The issue:
The teql master devices are created once in the initial network
namespace and their Qdisc_ops are global. teql_qdisc_init() takes the
teql_master embedded in the registered sch->ops and uses it without
checking whether the new qdisc's device lives in the same network
namespace as the master. A qdisc created in another netns can therefore
attach to the init-net master and change its MTU and flags.
The Fix:
Reject a teql qdisc whose device is not in the master's network
namespace with -EOPNOTSUPP and an extack message; same-netns teql still
works.
Initialize the private skb queue before any validation so every
constructor failure path, including qdisc_create_dflt(), which resets the
qdisc before destroying it, sees an initialized empty queue.
Conditions to recreate the bug:
CONFIG_NET_SCH_TEQL=y, CONFIG_DUMMY=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y.
As an unprivileged UID, unshare a user and network namespace, create a
dummy device, set its MTU to 60000, and add a root teql0 qdisc:
unshare -Urn
ip link add dummy0 type dummy
ip link set dummy0 mtu 60000
tc qdisc add dev dummy0 root teql0
The init-net teql0 device changes from MTU 1500 to 60000. A pfifo control
on the same device leaves the MTU unchanged, and a direct MTU change on
init-net teql0 is denied. The namespace needs CAP_NET_ADMIN; no init-net
privilege is required. With the fix the attach fails with
"Operation not supported" and the init-net MTU stays 1500.
Fixes: 7316ae88c43d ("net_sched: make traffic control network namespace aware")
Reported-by: shaos <shawnq1@163.com>
Link: https://lore.kernel.org/netdev/20261022144830.67948-1-shawnq1@163.com/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
repost1 -> repost2: rebased onto the current net tip. 8b2043279dae
("sch_teql: fix slaves_lock IRQ deadlock") rewrote teql_qdisc_init() to
take the raw spin lock with irqsave flags, so the hunk context changed
and the repost1 posting did not apply. The fix is unchanged.
---
net/sched/sch_teql.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 70c948a26f80..c5f171a66060 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -200,12 +200,19 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt,
struct Qdisc *first;
unsigned long flags;
+ skb_queue_head_init(&q->q);
+
if (dev->hard_header_len > m->dev->hard_header_len)
return -EINVAL;
if (m->dev == dev)
return -ELOOP;
+ if (dev_net(dev) != dev_net(m->dev)) {
+ NL_SET_ERR_MSG_MOD(extack, "teql master is in a different network namespace");
+ return -EOPNOTSUPP;
+ }
+
if (sch->parent != TC_H_ROOT) {
NL_SET_ERR_MSG_MOD(extack, "teql can only be used as root");
return -EOPNOTSUPP;
@@ -213,8 +220,6 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt,
q->m = m;
- skb_queue_head_init(&q->q);
-
raw_spin_lock_irqsave(&m->slaves_lock, flags);
first = rcu_dereference_protected(m->slaves, lockdep_is_held(&m->slaves_lock));
if (first) {
--
2.43.0
Technical Details
Message-ID:
<SER-NSBD.v1.r2.20261031160050-3@mojatatu.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-354144-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v1.r2.20261031160050@mojatatu.com>Show 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-354144-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 3/3 repost2] net/sched: sch_teql: reject qdiscs from another network namespace
Date: Sat, 31 Oct 2026 16:18:20 -0400
Organization: Usenet Network
Message-ID: <SER-NSBD.v1.r2.20261031160050-3@mojatatu.com>
References: <SER-NSBD.v1.r2.20261031160050@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2543662"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:aylaSqDoWNQBI4PxL9nWCWCg05k= sha256:SlL/C4Aa8E7sHCA0LoIHdEb+cearKG1IVj2AUj55ZTA=
sha1:zGva2/O6tT2N7fRzLBil653nuOY= sha256:hcIkvHCMktK227dkNhz1SICWdQkYbcVCEKPtAwpR8+4=
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 5B747125CBE; Sat, 31 Oct 2026 23:19:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=mojatatu.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 qYvaznsFzpuq;
Sat, 31 Oct 2026 23:19:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354144-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id E9C73125CB8; Sat, 31 Oct 2026 23:19:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 8C94F28488; Sat, 31 Oct 2026 20:18:32 +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=1793477912;
b=BNb+rjaP76cSh2lGNcdaMTsziQ6lF5K0JUrp2ULiHY6s7VFXl0PdP9KhkCmLJXJ/7/oB
ouUxhX/Y6mNCdLaWOszlzmeJ3DvoHgOdGWjGw2BLqYUnj2i5xnhDHC+2QvCCQ88zO+TIc
PIGHRpOa0sNa+eawz355PcNWS1cLwynqLn7OzruKnOQ4khKOJVieTvqr1uoRfrq6GdSRh
k/c6McZOWu69twRIQq2z9oHuLuK92JRZkr6W8US34kcisjGQrPD6LJK6lHJw++Acp+fa+
dPcZ/5cDUM0PpD76QNje5lGAcP/uhjyJiPPMnEiiMyNYH1hvy909SS9+S59a3s5Vw5g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793477912;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=jGKJiamAitTKQtqe2g22VNzvYmBlctd6oSPWEhMy8xg=;
b=X1GZVpF8hXLl1ksVx/gDklzkrl71dymyheSNtzOtBML7r00P5Xx0zkZo3GB/qX9pmswB
q6jDt0kHO1OHnH1LegstJxn6AhZ/1XurJbrTHNndXK1dR8Q6DX7Zw01AzrV6EzrV5CurE
iGr+Yq4ecxnTJWuVAQhBNVl8bJSMXuaZTYxl7YKqykGSn2P6QjqJcS5XiW9vNq4aS+PaG
YJW1dTQEZyJQgXZOZFYermSYZmBqmBlZoAVwmGJEdZnENTyH3rdqR2cyaZMeSDu7H6ZKY
Xd/5DHxf8SpiXoUDh8IA1x7SHid0f71pJ/N7KY9SXDCnSb/dZZeqMZsXIE0/H1jxz3g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b="CSW/oTos";
dmarc=none header.from=mojatatu.com;
spf=none smtp.mailfrom=mojatatu.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 64170606A325;
Sat, 31 Oct 2026 20:18:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key, unprotected) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=CSW/oTos
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.43
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793477911;
b=rzI16dj86CthQ/4aE4wNKmqqJovzJXYadQQBCMbW0xw0drx4bFaJD33FfkK9M6r63p67
MWjstUmc9NyMlPv0trGIm8sXdqs4ctfkI8A0k7YUo7AXcF+79aWtj70guXfYeyAHfcMDO
7Gxn0jxOIHCHi2ScPB88FMrzMGT+8evfZM6SnF4BDwU1UERi9fiZlw6BRh3YRN/wcVkVa
tEpRr2WvUpTTdTC1ymGCjcP8p7htz8ZJ2mjcfNxmXi2qlfJd25wyNEy6Or3j1syUPMalf
Mr4cN/JvQxwVjzgWlAvhAXS6jP5lSZZnWa8aMfkmto240iRtHayYOlyvT6DvCJWVymA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793477911;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=jGKJiamAitTKQtqe2g22VNzvYmBlctd6oSPWEhMy8xg=;
b=eecoUePr7gDei/Rj/g7x/ECMk9W2GCO8/6nJw+lKV56L3VXBTSSRUrn2Sfq/ymi/5+Qm
gp/wJaHAQA6Jj1mEscBeioRNTZuiux3X999RKNWAYGM8aQFjfMee+6NLRqaDjNeuihz24
O2JPKOdwFo+y3aC2YlReC/u6qY3WXlOsKkSZTaG/mZJmNI0SNTqO9kl4ALl7zeg/rmaCv
uJPBBMq+uytpLM+YjrBzo8R8SVH1j+86DrPdwfBlu6A5plGHDO9ocjHiLEBe2A71e0P+0
GsoBSca3GzM64KjtAAt1MCOQfU8/rNuB8EcBwi2HFXHSo6/CBM+mqxpIitMK0TAyHvQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=mojatatu.com;
spf=none smtp.mailfrom=mojatatu.com;
dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b="CSW/oTos";
arc=none smtp.remote-ip=209.85.219.43
X-Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 334B4606A31E
for <netdev@vger.kernel.org>; Sat, 31 Oct 2026 20:18:31 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 334B4606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-91c79f306e9so21510806d6.3
for <netdev@vger.kernel.org>; Sat, 31 Oct 2026 13:18:30 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1793477910; x=1794082710; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=jGKJiamAitTKQtqe2g22VNzvYmBlctd6oSPWEhMy8xg=;
b=CSW/oTosbHHKk97aJNAmCwOBy46OHvfIHs+LRYjW6TQPx7ZLdruWgSTKuZUulrGi0C
eZpR4tgHwAxcvcDmzuDGwdFFfUIexzPsvWPjj6OcxGKljaRGEWV9SrvKU5pVKjazt2vD
mQU6XJqyvQhi/ihKsdonp0+/2yBPOnqw/rvIc=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793477910; x=1794082710;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=jGKJiamAitTKQtqe2g22VNzvYmBlctd6oSPWEhMy8xg=;
b=OHfFIRYuby0oC641w3Lc1BgN5p+UFJ/UAca0+gnQ1X9+ibYUW7+8YRcAtVuzl1iNCd
JhFDgIRbRWEYJ9GE+p4kbQjMS90q6FMunsNn+YyZNhs8cJwzjq85B8ATQiUEBJhloWZJ
5fhyKDtp0NO1eCsA4femGlXVgiVAKvq6jG0G4yE7e7bk+j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b27mr102837326d6.29.1793477910007;
Sat, 31 Oct 2026 13:18:30 -0700 (PDT)
X-Received: from mbili.tail33bf8.ts.net ([64.203.83.2])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91ca7e23441sm49148926d6.4.2026.10.31.13.18.27
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 31 Oct 2026 13:18:29 -0700 (PDT)
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
stable@vger.kernel.org,
shaos <shawnq1@163.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Simon Horman <horms@kernel.org>,
Jiri Pirko <jiri@resnulli.us>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Victor Nogueira <victor@mojatatu.com>,
Tom Goff <thomas.goff@boeing.com>
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <SER-NSBD.v1.r2.20261031160050@mojatatu.com>
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