Article View: linux.kernel.netdev
Article #6069[PATCH net] net: xps: re-validate the queue index after switching to the subordinate device
From: Dudu Lu
Date: Wed, 21 Oct 2026 15:55
Date: Wed, 21 Oct 2026 15:55
82 lines
13966 bytes
13966 bytes
__netif_set_xps_queue() reassigns dev to the subordinate device
(netdev_get_tx_queue(dev, index)->sb_dev) but keeps using index, which
was only validated against the ORIGINAL device's queue count. A
subordinate with fewer TX queues than the parent's index then overflows
sb_dev->_tx[] / the XPS map:
BUG: KASAN: slab-out-of-bounds in __netif_set_xps_queue+0x178c/0x1ee8
Write of size 4 at addr ffff000005d3fae0 by task A-26-F1-S2/162
__netif_set_xps_queue+0x178c/0x1ee8
netif_set_xps_queue+0x38/0x58
xps_cpus_store+0x1dc/0x2b8
The store is netdev_queue_numa_node_write() on sub->_tx[index]. The
top-of-function WARN_ON_ONCE(index >= dev->num_tx_queues) only checks the
parent and is a debug assertion. Re-check index against the device that
is actually indexed once dev has been rebound.
Note this is a different defect from the "reject an out of range traffic
class" guard (4da3b7b8b50f), which bounds tc, not index.
Fixes: ffcfe25bb50f ("net: Add support for subordinate device traffic classes")
Assisted-by: LLM
Signed-off-by: Dudu Lu <phx0fer@gmail.com>
---
Tested base
-----------
Detected on Linux 7.3-rc4 (commit 93f51579e7df), arm64 QEMU guest.
Re-checked against mainline f47d223627f8 (v7.3-341): the affected code
is unchanged between the two, so the bug is still present there.
Checked against linux-next next-20261021 (commit 9a482184d910): the
affected code is unchanged there as well, so the bug is still present in
linux-next too.
Reproducer status
-----------------
A reproducer was written and executed on an arm64 QEMU guest (KASAN); it
fires at the claimed sink, and still fires on a kernel built with 4da3b7b8b50f
applied (identity established by disassembling both kernels: same store, same
target offset #0x160). The guest has no SR-IOV NIC, so the reproducer stands
in for that hardware with a small module that binds an sb_dev the same way
netdev_bind_sb_channel_queue() does for i40e/ixgbe. The reproducer source is
not posted here per Documentation/process/security-bugs.rst; it is available on
request.
Triggering conditions
---------------------
CAP_NET_ADMIN to set the XPS mask. An sb_dev is bound in-tree by
netdev_bind_sb_channel_queue(), which the i40e and ixgbe SR-IOV paths call
when a VF's channel is bound to the PF. The QEMU guest used for the
reproducer has no SR-IOV NIC, so the sb_dev binding was set up through a
small module; the defect itself is reached in-tree on that hardware.
Notes
-----
Built and checkpatch-clean: this patch was applied on top of 7.3-rc4
(commit 93f51579e7df) and a full arm64 kernel (defconfig) was built with
it -- no new warnings or errors. scripts/checkpatch.pl reports 0 errors,
0 warnings.
net/core/dev.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index e76762e29360..d5ce25144806 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2900,6 +2900,14 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,
/* If queue belongs to subordinate dev use its map */
dev = netdev_get_tx_queue(dev, index)->sb_dev ? : dev;
+ /* dev may now be the subordinate device, whose queue
+ * count can be smaller than the parent's. index was only
+ * validated against the parent above, so re-check it before
+ * it is used to index the (possibly different) dev->_tx[].
+ */
+ if (index >= dev->real_num_tx_queues)
+ return -EINVAL;
+
tc = netdev_txq_to_tc(dev, index);
if (tc < 0 || tc >= num_tc)
return -EINVAL;
Technical Details
Message-ID:
<20261021155555.68167-1-phx0fer@gmail.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-350095-linux-kernel-netdev=dewy.ruShow 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-350095-linux-kernel-netdev=dewy.ru
From: phx0fer@gmail.com (Dudu Lu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] net: xps: re-validate the queue index after switching to the subordinate device
Date: Wed, 21 Oct 2026 23:55:55 +0800
Organization: Usenet Network
Message-ID: <20261021155555.68167-1-phx0fer@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="4190665"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/KUUkW+gkZ8szZpwf7bNDFBkbas= sha256:3Zs440JHc9ihCNmtbTgUyeOKxMRvDAh2g+MoDJcM7UQ=
sha1:Y1qrXnfqX04jpuE9UaP2DB8D1p8= sha256:3XoHRS4JriZRJZD2tqmZliEUq24sXOL+f2ria44NOkk=
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 0A50411106C; Wed, 21 Oct 2026 19:01:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.047
X-Spam-Status: No, score=-3.047 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, 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 (2048-bit key)
header.d=gmail.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 io5DDDyBOWJV;
Wed, 21 Oct 2026 19:01:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-350095-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id EF0B6111066; Wed, 21 Oct 2026 19:01:28 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sin.lore.kernel.org (Postfix) with ESMTP id 78F2D2EF86; Wed, 21 Oct 2026 15:56:03 +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=1792598162;
b=pMuI6N1mLbPyVHQpVm1DOGUCEw8z/BG6N5vGTZTerGY+PVcqYPRs6f4hoIxzZJSIBqFa
Dmdueyr3+BwhKxTGZ4q/Jzfn8F6YYMuz+AfwdUKD6YmIaQh0oT1++AoTrMAD9H9P9BUYY
BxkR93ip6Qt+5S78XqXFZpr7Ip1HnsnfNnJPqETh/y3U2sITFUIB+BBznh5+p7TpKjgVl
ebjuTBzy8HwUy9x2GG/QHMJESuepdkCT00ZNDSfBAXunKn7hAOUdlWYOmDaKn36/WDV/N
clbGImFprPdiYorZoJyXhJPr2f39mkbKdE+n7dgw7hwJakNndGxiIojsOtZ7F3cMaZg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792598162;
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:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:Content-Type:
Content-Transfer-Encoding;
bh=KM9wJY2QfLW07XaMM0Z9rz5ZrePbeyOgedjaYIW3VG0=;
b=TYpC8b2O3Hx7R5VSDDySZ8NLSbjbkitfsGtEMAlQBs2DZe3scUDK00dZ2odN+IyWZtHl
4Qz0V/GNSN5y/AR53TTHOf4JtnBuGjzG8SN1bD95xBRlK3PJQ2VvILRwcqiYZVr5riu2I
1+tS8Kzh9N2AHy+BQxVuKwHoQCC1nggWbrH0CLj0VD1xa+x2ygexx3C6zlvcP2fnMDv2A
d6H5SjhrNm7NfpjQd/fC8DTPP58+E0Wc4quwAkVbaJQEilTETLxyv1EByWDIJwDd2W6XE
SURwy1amVbgVrNSSdVkHbmzw1Fh+J6Jkj+nKfOgWiOKDSbzI9h+svxBUvyzp0oMdkJA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=ZqSnkgBs;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.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 AF617606A31A;
Wed, 21 Oct 2026 15:56:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=ZqSnkgBs
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.181
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792598161;
b=rXexb5DzLYJ+ywdHEKCTlg91l0xme2dVlfqPBjQBwCAp41VERpEHRTW/TIroRJpeqn6E
8F6cKPW+/p5YfacIaYrVinf3C78W7wcVxMA86cEohgWG9ENmgWHDbacWUVbwNe6mRqZfv
zYgbGgOfxKxTz3103fUNeKZEWK2XTrpa3bQINKWN/b3J/WBD7Liql5bhnyxIucE83Pjok
XWXBcSZCPe7bW+dyFk6nJy47YFBtpoZELEzukT8bW6lxnUzSfJOYbZ57gCQMBE7hC42Mf
y+MCsrXJbHHYAWTyzODI+HMBFEZJK8C7Pa204+o7Bu1MCXZC40vtXfM/xzVyqsw0cmQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792598161;
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:MIME-Version:Content-Type:
Content-Transfer-Encoding;
bh=KM9wJY2QfLW07XaMM0Z9rz5ZrePbeyOgedjaYIW3VG0=;
b=0K08fA6h0imjrIdBI52hxuH6OCLKhiudhOO+brrDRepzmqzlJA2/lNxfOmNC+tZv9nhv
QhBGaZo2gzc5c+nvS2zlHvTuE1reMOgm6PZZvl+ytmBQUaTxcyM0C5Y3COxC1Tgaxd/sm
QuaPNv3ROP4fuF0DA+jhs0nnl+81pa7OqHrdygR+ldE4m+4gDtbLFmGT2M58Ko7+5oRv8
q4IQ34d1kVj6CFybdGsdaXcxmZgk165kDSNmXbAefqxTFX4SBb4Qs3DiCcyoPQ5OYo0uh
SibTx76TG6SDOzSshqWj0MLh/BEOSaHpwrUq4xuUgxxHovf5SmnFcSTu8i9Mb9duRkw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=ZqSnkgBs;
arc=none smtp.remote-ip=209.85.215.181
X-Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181])
(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 74217606A319
for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 15:56:01 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 74217606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-cc147d86bebso587868a12.0
for <netdev@vger.kernel.org>; Wed, 21 Oct 2026 08:56:01 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792598161; x=1793202961; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:mime-version:message-id:date
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=KM9wJY2QfLW07XaMM0Z9rz5ZrePbeyOgedjaYIW3VG0=;
b=ZqSnkgBsxGPV+doojtlxi2+vrjiYRP/sX0oPEg3h45nCgu6mkEWaVzTJ0mAku0TNWz
RKgvExPE+HC/ZOZDg75xmOofULmINfoPGc2AOACiApq9IAvismwHrv099Xjd07qdhUES
oyojVKrqcMTcZh+DRYV6GxNqpSnj2Qxy5XkvqKCkKEelwHLGVSfa+bpsdYdOzTMK2Kmq
Mm9jZ4xmbyDyM6SOrYEQN7oO7ba/xfqotmRY2fZ8JnnmXN/JTRTp3W+4bTedP5cKFS5y
LK6ygp9mMQ47UIa30/ffEiGkJvdyngQmSoFFeO4KnYgGWF5D3UNrt7QlEdb2gDLYAx2s
MEUg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792598161; x=1793202961;
h=content-transfer-encoding:content-type:mime-version: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=KM9wJY2QfLW07XaMM0Z9rz5ZrePbeyOgedjaYIW3VG0=;
b=oT+Yubu8EM7V+NBQkI50gNm98bvpZ5itHZDX7l/qd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w==
X-Received: by 2002:a05:6a20:d10e:b0:3e2:3584:c12c with SMTP id adf61e73a8af0-3e26f932cf7mr3364412637.2.1792598160759;
Wed, 21 Oct 2026 08:56:00 -0700 (PDT)
X-Received: from localhost.localdomain ([218.253.131.218])
by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cd6b8745546sm169643a12.30.2026.10.21.08.55.58
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Wed, 21 Oct 2026 08:56:00 -0700 (PDT)
X-Cc: netdev@vger.kernel.org
X-Mailer: git-send-email 2.39.3 (Apple Git-145)
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