Article View: linux.kernel.netdev
Article #19145[PATCH net v6 3/3] net/sched: sch_teql: keep skb->dev consistent on the arp-queue path
From: Jamal Hadi Salim
Date: Thu, 19 Nov 2026 12:40
Date: Thu, 19 Nov 2026 12:40
151 lines
16938 bytes
16938 bytes
This is a follow-up to commit dc4b95b8fee9 ("net/sched: sch_teql: restore
skb->dev on the slave failure path") by Victor Nogueira, which covered the
slave side of the same mismatch.
The issue:
teql_master_xmit() sets skb->dev = slave only right before the slave's
ndo_start_xmit(). If the slave's neighbour is unresolved, teql_resolve()
parks the skb on the slave's arp_queue with skb->dev still naming the teql
master. teql_exit() frees the masters on module unload and a slave can
outlive them, so a queued skb can be reinjected through freed memory.
The Fix:
Set skb->dev = slave before teql_resolve() so the parked skb names the
device whose neighbour owns it.
The parked skb has a second consumer: when the neighbour fails instead of
resolving, neigh_invalidate() hands it to error_report() and
dst_link_failure(), which read skb->dev to report the failure, so it names
the slave on that path too.
A parked skb is reinjected by neigh_update_process_arp_queue(), and a
device that transmits straight on skb->dev has to be handed its skb back
there. That is the previous patch, "net: neighbour: reinject a parked
skb through a headerless output device", which has to be applied before
this one: without it the parked packet leaves the slave directly, with
no link header, because teql_master_xmit() has already pulled it. The
helper it changes, neigh_update_process_arp_queue(), was split out of
__neigh_update() by commit 705ef89ac986 ("net: core: neighbour: Extract
ARP queue processing to a helper function"), so the previous patch does
not apply to stable trees older than that.
Some context:
Only a module unload frees a master. teql_master_setup() installs no
rtnl_link_ops and default_device_exit_net() moves the device to init_net
when its namespace exits, so the window is a parked skb plus CAP_SYS_MODULE
on an unloaded sch_teql.
The error now names the slave, so it is also routed for the slave: IPv4
takes the ICMP output interface from icmp_get_route_lookup_dev() and IPv6
from skb->dev. A teql master enslaved to a VRF had its host-unreachable
looked up in the VRF and now has it looked up in the main tables with
oif 0. The parked skb cannot keep naming the master there, because
naming it is what lets teql_exit() free it under this path.
Conditions to recreate the bug:
CONFIG_NET_SCH_TEQL=m and CONFIG_VETH=y, run as root. Create a veth pair,
make one end a teql slave, give the master an address and a route, flush
the slave's neighbour entry and send one packet:
ip link add v0 type veth peer name v0p
ip link set v0 up; ip link set v0p up
tc qdisc add dev v0 root teql0
ip link set teql0 up
ip addr add 10.0.0.1/24 dev teql0
ip route add 10.0.0.99/32 dev teql0
ip neigh flush dev v0
ping -I teql0 -c 1 10.0.0.99 &
sleep 1
The skb waits on v0's arp_queue while the solicitation is in flight.
Remove the qdisc, which drops the module reference it holds, and unload
the module while the skb still waits:
tc qdisc del dev v0 root
rmmod sch_teql
teql_exit() frees teql0 there. When the solicitation then fails,
neigh_invalidate() drains the queue through arp_error_report() and
ipv4_link_failure(), whose __icmp_send() reads skb_in->dev; that is the
freed master before this patch and v0 after it. A resolved neighbour
drains the same queue through neigh_update_process_arp_queue().
On the unfixed tree the skb is parked on v0's arp_queue while skb->dev
still names teql0, so the reinjection can reach a master that teql_exit()
has freed.
The park and the headerless delivery reproduce without the unload.
Freeing the master while the skb waits needs sch_teql built as a module,
as above.
An unfixed kernel reports this when the timer drains that queue:
==================================================================
BUG: KASAN: slab-use-after-free in __icmp_send+0x3f9/0x1680
Read of size 4 at addr ffff8880039bc0b0 by task swapper/3/0
CPU: 3 UID: 0 PID: 0 Comm: swapper/3
Call Trace:
<IRQ>
...
__icmp_send+0x3f9/0x1680
ipv4_link_failure+0x3a0/0x5b0
arp_error_report+0x5b/0xc0
neigh_invalidate+0x125/0x240
neigh_timer_handler+0x47d/0x750
call_timer_fn+0x138/0x410
...
Allocated by task 307:
alloc_netdev_mqs+0x81/0x930
...
Freed by task 335:
netdev_release+0x45/0x60
device_release+0x7d/0x120
kobject_put+0xf3/0x2e0
put_device+0x13/0x30
free_netdev+0x3b3/0x4a0
...
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Sashiko (nipa) <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260824115928.4099988-1-victor@mojatatu.com
Link: https://lore.kernel.org/netdev/20260824115928.4099988-1-victor@mojatatu.com/
Link: https://lore.kernel.org/netdev/20261026160747.283702-1-horms@kernel.org/
Link: https://lore.kernel.org/netdev/20261031165925.780930-1-horms@kernel.org/
Link: https://lore.kernel.org/netdev/179363700308.3131.11778179538290251434@kernel.org/
Link: https://lore.kernel.org/netdev/20261110101908.2e64e8e9@kernel.org/
Cc: stable@vger.kernel.org
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
v5 -> v6:
- the commit log names the neighbour patch this one has to be applied
after, and the ICMP error routing the skb->dev move also changes.
Considered comments from Sashiko (nipa).
net/sched/sch_teql.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 44730a5e8917..d1c66bd039d1 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -379,13 +379,13 @@ static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
continue;
}
+ skb->dev = slave;
switch (teql_resolve(skb, skb_res, slave, slave_txq, &hlen)) {
case 0:
if (__netif_tx_trylock(slave_txq)) {
unsigned int length = qdisc_pkt_len(skb);
int rc = NETDEV_TX_BUSY;
- skb->dev = slave;
if (!netif_xmit_frozen_or_stopped(slave_txq))
rc = netdev_start_xmit(skb, slave, slave_txq, false);
__netif_tx_unlock(slave_txq);
--
2.34.1
Technical Details
Message-ID:
<QDISC-6HS9.v6.r0.20261119070330-3@mojatatu.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367014-linux-kernel-netdev=dewy.ruReferences:
<QDISC-6HS9.v6.r0.20261119070330@mojatatu.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367014-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v6 3/3] net/sched: sch_teql: keep skb->dev consistent on the arp-queue path
Date: Thu, 19 Nov 2026 07:40:25 -0500
Organization: Usenet Network
Message-ID: <QDISC-6HS9.v6.r0.20261119070330-3@mojatatu.com>
References: <QDISC-6HS9.v6.r0.20261119070330@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2871814"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:b8plyDPo3MaJn1FX0Au2Zpu+j6Q= sha256:URp4AnyM4exnjr+DXnUBWjiLaiRizN1z39/t/jhNmEc=
sha1:QiB/nx1pFrdtHJk2iVv5eHpJhTo= sha256:Uo5Pm6FWCX+23B5CNzvGVaVh81nugKTjw/DCTAQjp/0=
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 B1FEA115594; Thu, 19 Nov 2026 15:41:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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.249,
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 si9m1lXS6QJf;
Thu, 19 Nov 2026 15:40:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367014-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 6814B11563B; Thu, 19 Nov 2026 15:40:46 +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 B4D6E492C1; Thu, 19 Nov 2026 12:40:44 +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=1795092044;
b=DfDRr7x46lwwDGQivhwywg7tZZBhCzkA7excYn+npZx07XO0azK+yObZbdfDoQ74JnXs
Pv73AvLHI3vKOXdRt1u7xrzk/V5CJSMtieau7itHHCymQIsiE5ZyEmosnnq+FHHZyZA05
KGoZ2gwotZ5tgL5PKkbkexlQkw0cZ9tuLsqd6kTq9jHjhQ9JyvQhsSg9J4CvEz3s0yoiC
R/LGRltBv9kSDm8SOLpVTq7edS7Wsigq6yRRq9QlNSymQI0YL1JwCkRJ01h3DvkjW3BZE
tI7PyezTLCbqwZgVGyUNwR66M5GpZLHyeYO60/Qcs6+b9CepppBCQl4gvj12SncIh6g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795092044;
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=kZTCP0FZNEDqOM0wu+GOAnEdBFK1bkrsKWVusL46FiY=;
b=EJp4yM63lZma3YX/DJS9l1VqFjCF+Xtc1MXxUD/Lz1Jd2ZEW/eNqC/G1zTWAqcMU5jET
Q4mKWw5PhTelqXtD3XGBl9Y54YZmsRo8ml5EQXcfI69IkZyLi6M4NVDnEztNaDMWhGxNs
OMMy3o30HRa5Ff0X/SUuh7MP2Q6lPGaWtsyB9pv2sePGQ6oyS840WRMa6i2IhZ7vaVj4g
c2RLWS6g/HFN+DAbspPS9+UplP4itGwbu1jRSr0JngTbS0rJGHW36vgOOVJ07bkz5AG6W
jziqZ+NUNi+0KofnppENVw2GfWYXUvUIJYPT+gQZkOwzahJCSl/CatlGKJgLRwft7/g==
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=qlqnTANW;
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 7911E606A326;
Thu, 19 Nov 2026 12:40:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=qlqnTANW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795092043;
b=e+Bn11cI5mZV+D7IoO31oxxD3Kz2JQk/KdUO11cerCkLLcIOTmokymmYAMkLsBKU/S8X
TdhwPanyfpaPD9i/SLS2yCKtP79304XRE1ht5Ana6XMudDbVQ0YOTwOtfWB4PzEn99rdo
EprS5K5h0/hBUzR3taBaj+eaJ0wzgoZUZyMAOeLCNg3u8vh03MP/gzLd9PKpOlKbF9wbO
DX2rX1ZGK1LLqWlF4wOO8Vva/Fj9d494eOJ7I+78BO7Rkpz0K+fL4Wblv840Wljn+dYr3
JK3vHH1JmzppNnT79h5HJuY1OrFVQU6qBmLmnk4p6Rm413VPjHb5rnTcrzvEiS1X4xg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795092043;
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=kZTCP0FZNEDqOM0wu+GOAnEdBFK1bkrsKWVusL46FiY=;
b=ODpKjOArXV6fS/E1UYld2QyVG7CGvA6yd23unxu2X0nVa1AfRonCcM952HeklSR6Qho1
1V+UxxlFb6I+wIrGdOLSLwCVoqZ3aa9TGGLTOsv9O+pxt+Up9OUw2CvpSrzjw28KYRiim
/8PCRh+Vk28YYYy/APEBt6kq7exuF7/fKoCsLMPS+lP6cXfRYP1rvkevFXbRyrpCUXhGA
AB8tNYD3iABn6xVGo5+zL/dwwW6MHfyTij5a60y5BvISgsxj/HiL+oG6/qVeidADmzqVU
m4FSGZDhTzWNZ377loT64ZxB4PA9KZe4NwxDJYW8cz+NeFs0zgUBvTrQ0rkzk9THHTQ==
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=qlqnTANW;
arc=none smtp.remote-ip=209.85.160.179
X-Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179])
(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 AD60F606A325
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 12:40:42 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AD60F606A325
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-qt1-f179.google.com with SMTP id d75a77b69052e-55d30c054dfso23095771cf.0
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 04:40:42 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1795092042; x=1795696842; 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=kZTCP0FZNEDqOM0wu+GOAnEdBFK1bkrsKWVusL46FiY=;
b=qlqnTANWHGUlzDo1V8GPg9BudgD19NxwE9qOTUzPM4Ra6aDF9fNTr7XEtB6DFqA0nr
BMeDdvVE87lHE3emUIDC61FQEO2+6anjzvYSg8UDzqufus1YIj+JmflrGRN4qTaPeqes
5RI5iVliNbtsAhqohm0AWXWFFAHkKibOXVNX4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795092042; x=1795696842;
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=kZTCP0FZNEDqOM0wu+GOAnEdBFK1bkrsKW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NZ8n6tUr8KdIBahpC+MTLOg86AnYdGrI0V
4cs8cLvi5C7LipGKvZI3GPLf8n01f/IFBgFHzLL9jRP4bPYECrB8RmK8nHmzkjewhzMqSE9CzZc
=
X-Received: by 2002:a05:622a:1822:b0:55c:8e35:c71c with SMTP id d75a77b69052e-55d5a69b306mr91009941cf.47.1795092041468;
Thu, 19 Nov 2026 04:40:41 -0800 (PST)
X-Received: from mbili.waya ([64.203.83.2])
by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d66b75823sm22370191cf.13.2026.11.19.04.40.37
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 19 Nov 2026 04:40:38 -0800 (PST)
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
Victor Nogueira <victor@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
stable@vger.kernel.org,
sashiko-bot@kernel.org
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <QDISC-6HS9.v6.r0.20261119070330@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