๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5374

Re: [PATCH net 2/2] net/sched: sch_teql: fix use-after-free on lower qdisc drop

#5374
From: netdev-bot+sashiko
Date: Tue, 20 Oct 2026 09:13
88 lines
11316 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

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] In teql_master_xmit() (net/sched/sch_teql.c), the patch
  replaces `== NETDEV_TX_OK` with `dev_xmit_complete(rc)`.

--

net/sched: sch_teql: fix use-after-free on lower qdisc drop

This patch changes the check on the slave's netdev_start_xmit() return
value in teql_master_xmit(). It now uses dev_xmit_complete() instead of
comparing against NETDEV_TX_OK, so a slave that consumes the skb and
returns NET_XMIT_DROP is no longer treated as still owning it. This fixes
a use-after-free when a VLAN slave's lower qdisc drops the packet.

> diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
> index c7dcec25ef420..b3efd5c281988 100644
> --- a/net/sched/sch_teql.c
> +++ b/net/sched/sch_teql.c
> @@ -350,8 +350,8 @@ static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
>  
>  				skb->dev = slave;
>  				if (!netif_xmit_frozen_or_stopped(slave_txq) &&
> -				    netdev_start_xmit(skb, slave, slave_txq, false) ==
> -				    NETDEV_TX_OK) {
> +				    dev_xmit_complete(netdev_start_xmit(skb, slave,
> +									slave_txq, false))) {

[Severity: Medium]
This closes the use-after-free. Does the same condition now also count
dropped packets as successful transmits on teql0?

dev_xmit_complete() returns true for any rc < NET_XMIT_MASK. That covers
NET_XMIT_DROP and negative errno values as well as NETDEV_TX_OK. All of
these now take the success block in teql_master_xmit():

    netif_wake_queue(dev);
    master->tx_packets++;
    master->tx_bytes += length;
    rcu_read_unlock();
    return NETDEV_TX_OK;

They also advance master->slaves to the next slave.

teql_master_stats64() copies these counters directly into struct
rtnl_link_stats64. There, tx_packets is defined as "Number of packets
successfully transmitted".

With the reproducer from the commit message (a VLAN slave on a dummy
device with a pfifo limit 0 root), every packet the lower qdisc drops
would appear as a good transmit in ip -s link show teql0. tx_dropped and
tx_errors would stay at zero.

The VLAN slave counts the same rc as a drop in vlan_dev_hard_start_xmit():

    if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
        ...
        u64_stats_inc(&stats->tx_packets);
        ...
    } else {
        this_cpu_inc(vlan->vlan_pcpu_stats->tx_dropped);
    }

Could the rc be saved once? dev_xmit_complete(rc) would then decide only
whether the skb is still owned, which keeps the use-after-free fix. In
that case, tx_packets and tx_bytes would only grow for NETDEV_TX_OK and
NET_XMIT_CN. The other consumed codes would go to tx_dropped (or
tx_errors), without touching the skb.

The commit message describes this only as a use-after-free fix. Could it
also mention that teql0's counters behave differently now?

>  					__netif_tx_unlock(slave_txq);
>  					raw_spin_lock_irqsave(&master->slaves_lock, flags);
>  					if (rcu_dereference_protected(master->slaves,

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-Y0BY.v1.r0.20261015184107%40mojatatu.com
Technical Details
Message-ID: <179248763469.3135.1739559328868319628@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-349134-linux-kernel-netdev=dewy.ru
References: <QDISC-Y0BY.v1.r0.20261015184107-2@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-349134-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 2/2] net/sched: sch_teql: fix use-after-free on lower
 qdisc drop
Date: Tue, 20 Oct 2026 09:13:54 +0000
Organization: Usenet Network
Message-ID: <179248763469.3135.1739559328868319628@kernel.org>
References: <QDISC-Y0BY.v1.r0.20261015184107-2@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3819515"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zrWXDNbvBDylT4kK/ToccEcqEJk= sha256:nRGK2oRbGfj7v17nT9DVKz1OIgZgnVopVKHgFsDVtWc=
	sha1:V7JxwXzxLqn/8302BfAis8C+LmE= sha256:SnzCKjw+EC4nNDSq10CDMVwIgEpEEJBdcwQdP77JdOQ=
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 15EE4110C58; Tue, 20 Oct 2026 12:19:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.729
X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, 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 dQRifgl9PuEV;
	Tue, 20 Oct 2026 12:19:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-349134-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id AF265110C50; Tue, 20 Oct 2026 12:19:30 +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 B8B7240302; Tue, 20 Oct 2026 09:14:02 +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=1792487642;
	b=oGbz7EQjAO6edb5bwitLKyQ2XvXsTFH0Y7JkzZXYaHtss1YbK3CJ1W9ILR+0D0HJBCQY
	 e9Nnksuf2/bqzHY5xRRUp1rGcl/keDe7eGCjhHyI9eYqEFwIIvg7Knxz3VM2rvaX9V8um
	 HGBqQRtndO0yZxuWDb+Czdmdg697umY255ItlrpGa9iaBhEleOP4llf1MIdDE20mLCHjm
	 jkw/+f4iybskUcuqF6B/Hp7hMUuJ8emfwhnDwziwl7A1ceiH2H+9O2f4E3IV5s/JJik0h
	 e68r+nc1pA33pomGDNXpSffzOD7P4HbnhLc743ytueuz6ZnpsCJJsim4N0AdVnBV09g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792487642;
	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=wR+QGy8NxY6UIZ6A7AByjSRgriA8JzRMJkxzuQ72kpw=;
	b=0JUhrYxieCSdfJM2KtKjW9+wI9iBNUdvaPB5D6azX1Qhe1uLroHRTENmL48blgAd5PwE
	 y3gCusefid0bKnHmtf/WM/ghUO/p2qjk32d0z7OsVF0NV/VpSWR6iXk8N8DjyTO05sL+E
	 2ycVpyEqvk96GQk7Ch89TQ2VMqaXoXQWbvYkaYRHDVltFqV5/yxajMGBUQk9/OOjkKYHF
	 zrw3J4cKzc5B8TabqIN48mjEIS73rwLXUd7JuOQMoHMTiiJGunCw6f9rSxt7nK4QxvV/s
	 ZevsCaPvAt05zxeBpnwNmBqyyPUd9YEj/JbhajSf1t0DLCjBrHVzyoZqEUvM4KJWIvQ==
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=DBD7IJ7a;
	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 61FF1606A320;
	Tue, 20 Oct 2026 09:14:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DBD7IJ7a
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=1792487636;
	b=FTjRmw7RaD+/asR4ksvZ906MV/40WkVI+KoTnscIL9C21Ex2XbuZkWUK9aWO3DtfONor
	 /pXd1vHNufGSdg2n1lxSVnV7DcByQKy4UfBpy+b8pke/2i4ztWaa+f+ze9MdiSsPXNH00
	 z/HlHBBgK9c2uEMngYViEYKzHbjVQnuSjtm+vwX5BCAkveJs5CgLJc6qrK1Om8925I86C
	 uIhlFIbukPuUnIaxRFw9HytMTpyYxbZk+SBoMe6YLkeG8JI25YiNNz11N+l9I+MR8AzMH
	 fuSr/Zh5vpAnppZpX7fpUZxy4Sy16UqGA7uIDVq0dtQlVM52bZZh+R5KvNtj2dgnItg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792487636;
	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=wR+QGy8NxY6UIZ6A7AByjSRgriA8JzRMJkxzuQ72kpw=;
	b=5ZCbqmFTmen/p1yt4U1fJT8+Jda+4XiGJe6ZZ6Vd+MHmPRB62fiB//fz/uvGZ0xUC4p1
	 TvOZTklIP1YzGjNNV0GZibecdHpAabqg3mpGIbwP6dDfEF7h+tTdzIOOc1mhSgB10sOa6
	 fQDh4EWS0nvfFcMdXiOSu5DhFNr15x/2wly1Y78JybsXYv/7FPuiQyqjxSQJ2qr86bKYP
	 AqPR6Mz3uAIdz2TW08xvALC/IQhzRlLxJnBcISpMoX6e6Ybpz1wb7BtAZna6QivkVpuy6
	 wULQ1iwB5WG31bg4G7oUAYfFI07jDJbj/ownKJg4/mielSBTCpQZqbSBkXsEkPS/a9Q==
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=DBD7IJ7a;
	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 43C62606A327;
	Tue, 20 Oct 2026 09:13:55 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D3C11F000C8;
	Tue, 20 Oct 2026 09:13:55 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792487635;
	bh=wR+QGy8NxY6UIZ6A7AByjSRgriA8JzRMJkxzuQ72kpw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=DBD7IJ7ay2J6j6G21jybk6qhnd8O9ASCI6L4xBpY7PhKhXoMnyXsMqDeb99Nq9r1j
	 Xs4Mah97QlYS3YmGCPSymE3uu2gEDiWcskP+lJ1YGjDyo2dF9GRXrxIUNXya/xjE/a
	 YJxIpxkhX82iJgePFNSMH1ABO4IznPN8NevpnEgfPAUNvMd1KJdm7YP3lQ3gOdqYG+
	 7Wb3Y7pGmsyp7ZxwtMt9gHRDhWhnIWR3CSAfQTjlqq7m7j8yss6Atshd4gg5YXU3ST
	 D3yoAykhUl7D4b+GbQyd+YRVHGHXFQiWI8huhCsnz53P8dOpMy4bFR+MOK7XY73APY
	 +Bbm0rnateuSw==
X-Cc: netdev@vger.kernel.org, owen@verialabs.com, jiri@resnulli.us,
 victor@mojatatu.com, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, kaber@trash.net,
 stable@vger.kernel.org
X-In-Reply-To: <QDISC-Y0BY.v1.r0.20261015184107-2@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