Article View: linux.kernel.netdev
Article #9399[PATCH net v2 3/4] net/sched: sch_teql: reject qdiscs from another network namespace
From: Jamal Hadi Salim
Date: Mon, 02 Nov 2026 00:37
Date: Mon, 02 Nov 2026 00:37
88 lines
14246 bytes
14246 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/
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v1.r2.20261031160050-3%40mojatatu.com
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
v2: considers comments from Sashiko (nipa) on the repost2 posting:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v1.r2.20261031160050-3%40mojatatu.com
The cross-netns check ran before the "teql can only be used as root"
check, so every case it did not catch was answered by that check, masking
the assertion that tc-testing case 124e makes. The root-parent
validation now runs first and the namespace check second; 4/4 adds a
case that covers the namespace rejection on its own.
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..dc21cd9704a2 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -200,6 +200,8 @@ 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;
@@ -211,9 +213,12 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt,
return -EOPNOTSUPP;
}
- q->m = m;
+ if (dev_net(dev) != dev_net(m->dev)) {
+ NL_SET_ERR_MSG_MOD(extack, "teql master is in a different network namespace");
+ return -EOPNOTSUPP;
+ }
- skb_queue_head_init(&q->q);
+ q->m = m;
raw_spin_lock_irqsave(&m->slaves_lock, flags);
first = rcu_dereference_protected(m->slaves, lockdep_is_held(&m->slaves_lock));
--
2.43.0
Technical Details
Message-ID:
<SER-NSBD.v2.r0.20261101171325-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-354387-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v2.r0.20261101171325@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-354387-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 3/4] net/sched: sch_teql: reject qdiscs from another network namespace
Date: Sun, 1 Nov 2026 19:37:05 -0500
Organization: Usenet Network
Message-ID: <SER-NSBD.v2.r0.20261101171325-3@mojatatu.com>
References: <SER-NSBD.v2.r0.20261101171325@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2808480"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:afr7G4XLZ/miLA4hEC2DKuxBXo8= sha256:3VBgrCZsppOq90m1wpliUu8/ngGtGa6rtmiSXh7JWp0=
sha1:JNyRnOo1DwCFQKldr/kUHbsIHug= sha256:41pO6TGpvbuIt/wStq0nwNLEEdx7FOH3KtlIo4mt7Tk=
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 736281123D4; Mon, 2 Nov 2026 03:40:40 +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 U6MJpBRXhqAV;
Mon, 2 Nov 2026 03:40:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-354387-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 1539E1123D2; Mon, 2 Nov 2026 03:40:28 +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 33BA933BC6; Mon, 2 Nov 2026 00:37:20 +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=1793579839;
b=W4HUqSeLSSKsdKUArYz2UjwYSaXJHXaU6xvflgCbY9aPqP+uaTDUu8kU+sHFG+pZuSio
yGSWA5TRkhmTebf4KPhWUj98Dyq75VxFFKm3qX4jIksW4+UuX33pEyXhQ9XiNS7hjUx9C
zPbxmh4CBIFauiQnZDcZs8A9AbCUxF6J7LnYvlHSITgDZNI8tXUA4/J75eQ1WhseZgY0+
umJe5XuVN3UPNB5gsj6WlBxasLMCjRbROAY0Q3IIwdxukGYtsImpOUbU2787rwppbWGxN
XSJfgQqzcLCWK8GA9Ix11vlJAk9czudGMDvsFpLOBtFTad2GmzqE4Ptw8VMZ7tbIbZw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793579839;
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=aHxNiJHHxEssGSp/2Xs2oy5YS0nrj3YMaZixDHo/tOw=;
b=J8WLtfSezhlZQRNurl+8X4XvxDthvOKT+KJZMvJZapYiyfdM3ajomQZ7kuBDZuQjHAMa
ixQ7WgoLJjveLW1ee9MjecU9rcXzu9fPaG5rPLhRF4uXc+ZMsQELEYu1fcsbOgYqw3O6O
KFB4MtxQBHFEc/4krYzqB3g4GiUq6XT8BO/EJlau8VVKniR93oqmZ6l3GO+n+zw2uArld
+XA68+a5cpol6tjlOql7v2HpoY85KmmFQJ1e2lepYR5JoSongxYUmT+vu7Dtb0xGf9cHN
Se780ibrEai18hLbQIfxTF4zyAMyPDH+eTdU7nV8na6p3w5UC3yWi/hR0gccMu73YlQ==
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=A1VpEPx1;
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 8431D606A339;
Mon, 2 Nov 2026 00:37:19 +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=A1VpEPx1
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793579838;
b=tkUsiLotf5W+eINvZ86GYkF6nEKjQZ29GVPHNa+KZaahP7esTDJcuhb9oHqI+aFsv/es
f1qVyu8vcsTx+uSx5IxuWvCUFNZ1/7Kt3Vo8qpr0zBvsWs1fMKCp0UCUzoJzU5HHD93AJ
lsuTPKDMkE6Vg2MQXSURQKUHb2b9x1kfdB77Mgmgps63+WNcq4wKiWGcvuBWJgNpGBjbp
gZ6Pnh+rWuf9B7nYQjnoRoE3y18zAroCNU54/pHLj2JosEbRhS8V8s5HkP0gy8qh1bWfZ
tpl49BzvadHHxdQDx41fEobh3D1FYBdEZ9Ge6VFgV1W2VZCrgiOX4E+MeO3wPLJKZgQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793579838;
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=aHxNiJHHxEssGSp/2Xs2oy5YS0nrj3YMaZixDHo/tOw=;
b=C9XoFMpvOGXdxGdjyynPceW6XPn8AcSNj9VR4esoQhLPss8eNHukTmb7GJX9VbGMyHpZ
MYpVJGAB2tT/tQLH7Or7eM9yqYniqy2lbQruBb/aQtYSfAtZEG4mJXE/JfD9Wv2vTveG5
GQ4MR2TKg2/LrZPNbil+7OwjFiErH5APPVu0PE/SIl9lg241Bczv+b52N5ig35dvYyc4L
8zk7UZycr2jIa3Xas6gV0tiwQvcX+0m4a3d93fWWLmda+OHrmzrXF0+TW0r+4zJFz5NR5
f2aWKlfAHRItp6MHhhmmszlSYBfx0B5p0mTsqatBtXeOTWAUUdw2iGG8rcA73A1D2AA==
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=A1VpEPx1;
arc=none smtp.remote-ip=209.85.219.46
X-Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46])
(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 546AB606A326
for <netdev@vger.kernel.org>; Mon, 2 Nov 2026 00:37:18 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 546AB606A326
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-f46.google.com with SMTP id 6a1803df08f44-91c79f306e9so29599396d6.3
for <netdev@vger.kernel.org>; Sun, 01 Nov 2026 16:37:18 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1793579837; x=1794184637; 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=aHxNiJHHxEssGSp/2Xs2oy5YS0nrj3YMaZixDHo/tOw=;
b=A1VpEPx1JwWNrUP3+P38+4tfAB5W5YbvAoGRutm3oWD/PL0fybiPt7a/mhpZDr7LGJ
D1ObOtnWgXswSTSUXFwFifMQZpIPrBUzoyvKoQ9YSmte4R4xk/tesiSqZkxCahg/dil9
fMZAG+Tsw6GjbAmF22Xi4+6jptWRDc60Bb7d4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793579837; x=1794184637;
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=aHxNiJHHxEssGSp/2Xs2oy5YS0nrj3YMaZixDHo/tOw=;
b=y5A3HwuXB26g2dnTxgkIn5ehIVYiI/3q1JJznMXZ75VL7os0WeiuAjBI1H8kZDF8tK
MROhHR/y9ahc2tzHVYH6T+ftBzXqd1Ev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zBM4X0RA
rIvZ4hSxB8++MCMI=
X-Received: by 2002:a05:6214:4346:b0:91c:67a7:1360 with SMTP id 6a1803df08f44-91ca4b1a2f9mr143205086d6.27.1793579837186;
Sun, 01 Nov 2026 16:37:17 -0800 (PST)
X-Received: from mbili.tail33bf8.ts.net ([64.203.83.2])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91ca7f23754sm77043066d6.9.2026.11.01.16.37.14
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 01 Nov 2026 16:37:16 -0800 (PST)
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.v2.r0.20261101171325@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