Article View: linux.kernel.netdev
Article #12506Re: [PATCH net v3 3/4] net/sched: sch_teql: reject qdiscs from another network namespace
From: netdev-bot+sashiko
Date: Sat, 07 Nov 2026 14:50
Date: Sat, 07 Nov 2026 14:50
162 lines
14455 bytes
14455 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The fix checks that the slave device and the master are in the
same network namespace only once, in teql_qdisc_init()…
- [Low] The commit message says only that a qdisc from another netns
could attach to the init-net master "and change its MTU and flags".
- [Low] Moving skb_queue_head_init(&q->q) to the top of teql_qdisc_init()
(sch_teql.c:203) is presented as groundwork for the new netns failure…
--
net/sched: sch_teql: reject qdiscs from another network namespace
This patch makes teql_qdisc_init() reject a teql qdisc whose device is
in a different network namespace than the teql master. It returns
-EOPNOTSUPP with an extack message. It also moves skb_queue_head_init()
of the private queue to the top of teql_qdisc_init(), so every
constructor failure path sees an initialized queue.
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
Link: https://lore.kernel.org/netdev/179366641863.488856.17368571591466000274@kernel.org/
> 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.
[Severity: Low]
Does this description understate the impact of the bug?
Besides changing the MTU and flags, teql_qdisc_init() links the foreign
qdisc into the master's slave ring, or makes it the first slave:
rcu_assign_pointer(NEXT_SLAVE(first), sch);
>From then on, teql_master_xmit() round-robins init_net traffic sent
through teqlN onto the device from the other netns. There is no netns
check and no skb scrubbing:
skb->dev = slave;
if (!netif_xmit_frozen_or_stopped(slave_txq))
rc = netdev_start_xmit(skb, slave, slave_txq, false);
If teql0 is already up with slaves, the attach still succeeds as long as
the foreign device has compatible flags and an MTU at least as large as
the master's. A CAP_NET_ADMIN holder in a user namespace can set both.
With a veth slave, the netns owner could capture or drop part of the
host's teql traffic. It could also answer ARP that __teql_resolve()
sends on that device.
The code change closes this path as well. Since stable and CVE triage
depend on the stated impact, could the commit message describe the
cross-netns traffic interception?
> 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.
[Severity: Low]
This isn't a bug, but should the commit message say that this reorder
also fixes an existing NULL pointer dereference?
Before this patch, three returns happened before skb_queue_head_init():
-EINVAL (hard_header_len), -ELOOP (m->dev == dev) and -EOPNOTSUPP
(non-root parent). On those paths q->q was still zeroed. When init
fails, qdisc_create_dflt() calls qdisc_put(), which leads to:
qdisc_put()
__qdisc_destroy()
qdisc_reset()
teql_reset()
skb_queue_purge(&dat->q)
skb_queue_purge_reason() sees list->next == NULL. That is not equal to
list, so it treats the queue as non-empty, and skb_queue_splice_init()
dereferences a NULL first pointer.
This looks reachable with net.core.default_qdisc=teql0. mq, mqprio and
taprio create children with a non-root parent, and
attach_one_default_qdisc() on teql0 itself returns -ELOOP. Setting
default_qdisc needs CAP_NET_ADMIN in init_net.
Would it be worth calling out the crash fix explicitly, for backports
and Fixes: attribution?
> diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
> index 70c948a26f809..dc21cd9704a25 100644
> --- a/net/sched/sch_teql.c
> +++ b/net/sched/sch_teql.c
[ ... ]
> @@ -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;
> + }
[Severity: Medium]
Is a netns check at attach time enough to keep the master and its
slaves in the same namespace?
teql_master_setup() never sets dev->netns_immutable. That means
__dev_change_net_namespace() lets teqlN move to another netns while
slaves are attached, because this is the only guard:
if (dev->netns_immutable) {
NL_SET_ERR_MSG(extack, "The interface netns is immutable");
goto out;
}
The move runs dev_shutdown() only on teqlN's own qdisc. The teql slave
qdiscs on the init-net devices stay linked in m->slaves:
teql_master_close() only stops the queue, and teql registers no netdev
notifier.
Once the master is in netns B, three things can happen:
The owner of B, who may be root in an unprivileged user namespace,
passes the new dev_net(dev) == dev_net(m->dev) check. It can then add
its own devices to a ring that still holds init-net slaves.
teql_master_open() takes the MTU and flags from the init-net slaves.
Traffic sent through teqlN in B reaches teql_master_xmit(), which sets
skb->dev = slave and calls netdev_start_xmit() on the init-net slave.
Through __teql_resolve(), it also calls ipv4_neigh_create() on the
init-net slave.
Moving teqlN out of init_net needs CAP_NET_ADMIN in init_net, so the
unprivileged user cannot do this alone. After this patch, though,
moving the master seems to be the only way a container can use teql.
Should the master be marked netns_immutable? Alternatively, should a
netns change of the master be refused, or detach the existing slaves?
> - skb_queue_head_init(&q->q);
> + q->m = m;
>
> raw_spin_lock_irqsave(&m->slaves_lock, flags);
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/SER-NSBD.v3.r0.20261103064310%40mojatatu.com
Technical Details
Message-ID:
<179406301946.994134.7212801896124135602@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358402-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v3.r0.20261103064310-3@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-358402-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 3/4] net/sched: sch_teql: reject qdiscs from another network namespace Date: Sat, 07 Nov 2026 14:50:19 +0000 Organization: Usenet Network Message-ID: <179406301946.994134.7212801896124135602@kernel.org> References: <SER-NSBD.v3.r0.20261103064310-3@mojatatu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4134844"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:a8Pucudm31GNeZZt8RKi9ay79cc= sha256:Ec3mbTuARtFvh8gRQ/wwcqqHQ7qhDkyMf9NaBYJDs+c= sha1:pX7rUMa2SRLCsTIeKj2qhK3skTU= sha256:488NjhLC1OEa9JQa7L4PpZdMLm9k/48CWAvBxwzDmh0= 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 2C99C11344B; Sat, 7 Nov 2026 18:55:23 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=pass (2048-bit key) header.d=kernel.org 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 XNWL58iYL74y; Sat, 7 Nov 2026 18:55:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358402-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 298E9113446; Sat, 7 Nov 2026 18:55:06 +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 D7462E3D40; Sat, 7 Nov 2026 14:50:57 +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=1794063027; b=fZDjmgVBLYpsksKjS3ODKQvmpA7XTtdE1j6za/yy2ZvYMklZS0u+k9EPvJqrCGGtLDVR oOHiTBGCZ8R8u1qsRep5kiTjqvtR3+QIidy2lMIr2CP3uyJ0ZT+OTH16h1DMDsbaMc1Sw flDlqZG7GglfHUR1Ue+d385mAInP0k6aPEqeb52EvbleMARJy7FlCwGja3zLSurTrY6QJ w/0YDcSnwCW48/i9z0buLhEso2p0Ee0UjRvUbpIazqigsRhZKqGA/wQUMNWFc0S8TVwPF /6dqskzBGeE00PVwLwbRuhMnnaFK7MCGaMTpIz6En8TfLvPjzRN6lAXQxNhccG6OnXA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794063027; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=xziTI3YYXoskqI56R/QdTymEmbBbGrcSZUWa4NYlYs8=; b=LxV7eUmfR3GseKN67HDvDP3pKOjOirXo88ffeiPxBCgTxl8S05QETqzT2AFTbRJzh66m JGHnycVFcba7/2ho65J0y2khK7N+wNQ6GwF9iql8k1cWXSn0DCyOaZMRdGNeEP2QHPgms 9PkCYUj4Hsb6oHSRqNYKPHf4vGtWIOUbNXqr5dw2DULuDmsw/YWmMud0ydYrGUnJcihIx lfSxMXWuTQyluK8KKZCDj1aqVV2Karc7+wKE+46cOnG8krfU8wFdGFJEJOyXPDOcJ10wi ehLR21HUEKnjmKjiVBZicxu04JyFpBvXVjc7prGBI6DLnYU252HhdG8T7DFckDiV5jw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MHkhNWd+; 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 4705C606EE9B; Sat, 7 Nov 2026 14:50:27 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MHkhNWd+ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794063021; b=QU+YTzjwIUuhNckcyX2XwQq25KGcKOFMTvbSm5mPfKLa43UTgY4k4/0R7idfhbeh/Wl0 bG6AvaiArT8obGPad/DeCwZz3r+qHapZ0Q749vWZFLWbvYy6J4SttNhrb/EJDAvvkleJm GHUEY1zrFc77M1wiS8BjZqD1RKOCKYv+ScK82b7liejnLq60M+CsaOIL8qh1uaxRRxrDS DxMyqpWCXQ0jvD/NheU+iR2RskhAj17VToOuIHG1CB9+YHBpZHEs208IPgpw2jOp0iYHV z+70R/kmUt7iS3mn+VL3UIDD5BJW5N0ln7AUOtQB2CmJSiggF8gyTdrUTCnKXKZIgAQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794063021; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=xziTI3YYXoskqI56R/QdTymEmbBbGrcSZUWa4NYlYs8=; b=0FP0qq3NZgVwnQjCWMcbiYrUBZB7uRlooTvdezQnGR718qK5YIUT/U6FJc/7iFjUwvzn GnAoXRbm6YIbqRxgQxCg+X4ejKCNe1KAgQanisUSVXar+GJik0GdJjPT44NCybiXErcsS jMUd6zqTGyjMCxGsTb496GUCMN1qPVWe9QZPdTldL+sLPuFKNnbIZOTxPfsh8kG8b/PTi OYcnD8APfl7xTPhMDG38VMvY73Mfn6qkGbtZA5C9qY1zsrVczB2fbQzuVGDNgKLQZox39 /BrjoXUMhT2cVBOZxO/lSv9afzOvlA7Ust90Oj3GJgt89OTvsLEsRnbfVyAK0xXQQIA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MHkhNWd+; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1966B606EE90; Sat, 7 Nov 2026 14:50:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5C641F008A1; Sat, 7 Nov 2026 14:50:19 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794063020; bh=xziTI3YYXoskqI56R/QdTymEmbBbGrcSZUWa4NYlYs8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=MHkhNWd+ccUY4Jd5KfYGhVuDD3ZCdTUJmjHuVlouN0Fdo1QjKGhA0qJgRPxcthDZz xb28HTcUZmTFOpLTM04kxqzOMMcin7RNrmW+ziygyOVK4/MoV9gFZC/nVNFGcp5pOU QxwxLmjyOteYomnqOCuPq421URTMldl+KaZ0z/Q+y85NG1aA5sW8g8febtuX0q33SQ TdCkDOFDxAO0mVb74ydDN42XRx81DXxnngLx+TZ/0DH/6RhKEVh6jC76BwFZumseCU VuHlC28SK6jmmlhGFVRtW/hngbE/KJeXUNud9SEymrE/eZuMECf3Tn8ZR2SLGay7lE dsy3Dfg7lyH4A== X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, shawnq1@163.com, davem@davemloft.net, edumazet@kernel.org, horms@kernel.org, jiri@resnulli.us, kuba@kernel.org, pabeni@redhat.com, victor@mojatatu.com, thomas.goff@boeing.com X-In-Reply-To: <SER-NSBD.v3.r0.20261103064310-3@mojatatu.com> X-sashiko-severity: Medium 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