Article View: linux.kernel.netdev
Article #6873Re: [PATCH net 2/2] net/sched: sch_teql: fix use-after-free on lower qdisc drop
From: Simon Horman
Date: Fri, 23 Oct 2026 16:28
Date: Fri, 23 Oct 2026 16:28
95 lines
11731 bytes
11731 bytes
On Tue, Oct 20, 2026 at 09:13:54AM +0000, netdev-bot+sashiko@kernel.org wrote:
> 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)`.
Hi Jamal,
Maybe things have moved on for some reason.
But this concern does seem to warrant a response.
>
> --
>
> 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:
<20261023162821.GN708417@horms.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-351151-linux-kernel-netdev=dewy.ruReferences:
<QDISC-Y0BY.v1.r0.20261015184107-2@mojatatu.com> <179248763469.3135.1739559328868319628@kernel.org>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-351151-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/2] net/sched: sch_teql: fix use-after-free on lower qdisc drop Date: Fri, 23 Oct 2026 17:28:21 +0100 Organization: Usenet Network Message-ID: <20261023162821.GN708417@horms.kernel.org> References: <QDISC-Y0BY.v1.r0.20261015184107-2@mojatatu.com> <179248763469.3135.1739559328868319628@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="548371"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:vsJLRkBYubcxQ2hEvBEqajkvWRQ= sha256:DgDEBrd2sLcvgcsKL39hZP3MXKY5nDMu6RWDAJ3ietA= sha1:EXTnSqSBygTJOx4k2binkq5nw+w= sha256:pxNTJ/fUo0+mULKpaFIr+xOu4zQpiYKI5mJanCZe8PU= Content-Disposition: inline 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 E1411111523; Fri, 23 Oct 2026 19:28:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.838 X-Spam-Status: No, score=-3.838 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.339, 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, URIBL_BLOCKED=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 KFVN_sVmt4lR; Fri, 23 Oct 2026 19:28:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-351151-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 29945111520; Fri, 23 Oct 2026 19:28:40 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 1A82E60822F; Fri, 23 Oct 2026 16:28:39 +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=1792772917; b=O65onKu6bMIInwKp6hICQcak1mXHuSyXYlcDBG5DCFZOTWPlQdzQVy9lJ1j6xPNlC+DE cEzi72XYcHJCu0naLjeuqHiV7NvihOGFhKJJwwwkpBJUivEsg1ogAEMCTJ23cwMYqUlH4 JLrnyDXBcz0SKnlmbsnM3dlQY7NeCNR+ndCfImY/6lar05dAxArCP4d/SlTChwoeSS4Ad cZ1BcUnVdnjuoPjv5oJsUdAt7xjGoeIGkjNjgzcn2gqW6AuiKku1LvQ9ICKM8D+kZgfUS 6ztbdoxXU/YdWTc8F2a6ekd/0LX+NlvOzv8eb4Miaifm4nCKJXu68t288FIX7J+LXZQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792772917; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=Co97Y0p41uorR92GJeOhUDahiBIaQEoa0saPKr2noM8=; b=K4A9+WhrzV6FvlSFve4un5nWc1pXTOiU4p7RQbOnEVmvYIgx2RBb+kW3/fEsCwyVL6oR o1aHfTAsJPLqD8A0TJLdJxSyl0A9PzXkuZyB/el/bqZ+I+URW7jZZ8DffPqNqw7wRRouA txvH+uPlxbTJFrqQWI1rvZvTEoiYncARtwN2n7Qmhug+fkGHLBPv2j4vmur6M/5zdXbRi wwMfAZ5alcHiLONo6O4sYaNhLMOalDihgv4MEmXKwrOwQrjumM13PiPM4ir5O+rNCWVfz XCHA48rkqP/BzmaCqg3HjgT8GBHLfVDaELn5njgevErpqxLcT4PBJCt/bIyGIqLeJgw== 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=OojpiN35; 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 C5E7F606A325; Fri, 23 Oct 2026 16:28:32 +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=OojpiN35 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=1792772906; b=baWKJbvCcrIP78GX03285APwEfhVWabdm4kh/dA/zBzx+WTtrC/nWK1ncKCnewJX/X5d 611mFClCLO+CHj1gXCFq0dKZoDN1JQ+ptavakw3+BuHAA7nRZ+iGY728W051ggvIKkYuF r5x0dKnQru7CHmyrnkTsk2VfZWSEMPntADmvlCmxnlEtfaYhJF398pz5LWGHFpII48+oU +xdociMK7dOM4U1Tfn39k85dmQw7VF6vk6BlIeHKKKJ772/LJ5X1i2FcMY33P7jLaZY2B LO9mmZIJDr/RSULuqxeG+TxjXW9ni4ubPmzMZ5VJ8jfGH/D9VPw3715iI1dnGSA6Eew== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792772906; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=Co97Y0p41uorR92GJeOhUDahiBIaQEoa0saPKr2noM8=; b=W/rVsNUWl2WhJpF1+qWC/vuM/nUin/itpeuUtgK7TMktEMoQq1KIj744nhgj/NeZTs+v 223dkV6/eKosGWrLaEJD9s2v/BzVzDsbGuO0hWbdwXV3yDUcBmVqkVmmXfgZDeolm1gu6 oEeqXHuoyDJCHodRq5toDIa1dsFOCz3cN/pjWc9t9GVqITr06sGMr25DhBIH1keVRTtKy 8ZsGtvXgTlKxVPu6dr+BF3xisVHwMguwKVgX55VcCEgurLkXiar+4knbh0Ssd9cKLmXHc ST9QzkDoAAq2O6HS0cIvE2mp2vh/He4hP51Jd1dnEyPON6FAzGC43Bu208QuY29jjdg== 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=OojpiN35; 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 7DEB8606A324; Fri, 23 Oct 2026 16:28:26 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAEFC1F01825; Fri, 23 Oct 2026 16:28:23 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792772906; bh=Co97Y0p41uorR92GJeOhUDahiBIaQEoa0saPKr2noM8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=OojpiN35R5m9Yj0Ve6tqyjOGsScUD1AEIt+CecU0CVUjyrDZnLoNaOlJyH699BiWW Y64Rxr1/hs+JXyrQHG/AuDtFDj1KoAU2VIRD9f/yPvDDkIg2w7Jfeq52ukwgNnzp69 VoZGtaIgbUcvWGoRWmG4rLj69/Z92fnq+bqU4IF2n55mBJRlaIUpVJwss/zVy4+92I v+PGgM0xND6gzNNOSv8Fj3WEjL2nPzTech//bKrpdraaMlof0/YqWrYFyF0SAPp/rv pQSb+RD6RLHpuH2nj9/9T9G04ywIiAjS6hQGaW+tofWloizuyQZBxjnqoYKbmEE8J2 eXFFL6TCS4+Yg== X-Cc: jhs@mojatatu.com, 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, kaber@trash.net, stable@vger.kernel.org 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 X-In-Reply-To: <179248763469.3135.1739559328868319628@kernel.org>