Article View: linux.kernel.netdev
Article #25048[PATCH net] net/sched: cls_u32: fix hnode UAF in u32_change
From: zhuorao yang
Date: Tue, 01 Dec 2026 07:50
Date: Tue, 01 Dec 2026 07:50
74 lines
13028 bytes
13028 bytes
u32_change() looks up a non-root hash node and keeps only a bare
pointer while it allocates a filter handle in that node. The subsequent
action initialization can drop RTNL to request an unregistered action
module. A concurrent RTM_DELTFILTER can then delete and eventually free
the hash node.
When action initialization fails, the error cleanup removes the handle
from the hash node's IDR through the stale pointer, causing a
use-after-free read and write.
Hold a reference on the hash node from before action initialization until
all uses of the pointer on both the success and error paths are complete.
This makes a concurrent deletion return -EBUSY.
Fixes: e7614370d6f0 ("net_sched: use idr to allocate u32 filter handles")
Signed-off-by: zhuorao yang <alex000young@gmail.com>
---
Vulnerability report
Affected versions: Linux 7.4.0-rc5 at
fe6ff8d5d675c01793b9f051d16055dd4aa75244; the defect dates to v4.15
and applies to later kernels with CONFIG_NET_CLS_U32.
Trigger conditions: CONFIG_NET_CLS_U32 and CONFIG_NET_CLS_ACT, with
CAP_NET_ADMIN in the target network namespace. An RTM_NEWTFILTER
request selects a non-root hash node and references an unregistered tc
action, so request_module() drops RTNL. A concurrent RTM_DELTFILTER
can delete the hash node during that window.
Reproducer status: A QEMU test with a test-only modprobe delay showed
that the unpatched kernel deletes the hash node and later runs
idr_remove() through the stale pointer; kprobes recorded the destroyed
IDR and the later access. With the patch, concurrent deletion returns
-EBUSY and the error path only accesses the live hash node. Reproducer
material is available to maintainers on request.
Reproducer material is intentionally withheld from this public message.
AI assistance: DeepSeek identified the issue and drafted the patch.
The submitter reviewed the code and certified the Developer Certificate
of Origin.
net/sched/cls_u32.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 91f4e6458785..506640323335 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -1188,6 +1188,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
}
#endif
+ refcount_inc(&ht->refcnt);
err = u32_set_parms(net, tp, n, tb, tca[TCA_RATE],
flags, n->flags, extack);
@@ -1216,6 +1217,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
rcu_assign_pointer(*ins, n);
tp_c->knodes++;
*arg = n;
+ refcount_dec(&ht->refcnt);
return 0;
}
@@ -1235,6 +1237,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
kfree(n);
erridr:
idr_remove(&ht->handle_idr, handle);
+ refcount_dec(&ht->refcnt);
return err;
}
--
2.56.0
Technical Details
Message-ID:
<20261201075058.64049-1-alex000young@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374806-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374806-linux-kernel-netdev=dewy.ru
From: alex000young@gmail.com (zhuorao yang)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] net/sched: cls_u32: fix hnode UAF in u32_change
Date: Tue, 1 Dec 2026 15:50:58 +0800
Organization: Usenet Network
Message-ID: <20261201075058.64049-1-alex000young@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1651804"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0kSOBuQP+1NF55vY8Gmup260WjU= sha256:qIOXOV4kXKjTy8iC21hiAcjY3hwRedZ9VZMWl1Gogdg=
sha1:Z0XnNoTWE56RPaUnGkCDBR7+ccg= sha256:PRs2aIO5IdSN9MUlceHmE4xXhNGJJUjoZD8HDP6iHyY=
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 D2B13117294; Tue, 1 Dec 2026 10:56:03 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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.249,
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=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 bU9xzGqu9yto;
Tue, 1 Dec 2026 10:55:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374806-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id C4B0F11729A; Tue, 1 Dec 2026 10:55:46 +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 4ECA32A82F; Tue, 1 Dec 2026 07:55:41 +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=1796111741;
b=mq8eddAslhoHLTWAtzFDUFTpb4GXnnatEfyvj493dqm+x5cAxQuXg0UF7nBjIG6Frm4O
e32TL4ajP0nYwQB8DnkXBbs+5ErfkMda/N5Fij3nbDx62Qg5BpJdFKyVyppYHzvKj7s98
kiHqKIVwWybuOzXALrZ3ofOkfyGC6AwZqDGDfKVLklhJpRl2eeTaGN7SxJA8+wtqWpWII
ElPWuzi7M9RE0tHYsilfVZNH9xw9+nwEBB+5Qd3rmDA6eU+J0ErozhYlHEIqUMdPuB3bu
rbe4vw629Iusdl3C2qu1lnnK47qxPMoR2FCC+LwP4TydeZ9Nqdob8qqtfzRc3/Gi0DA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796111741;
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-Transfer-Encoding;
bh=RCPP47sxEPwmydHxDeBSAihWq19vUajNGVuVIaiFTOE=;
b=rp2yzOZxWGmcp2K6JpnI8ixa09AoljGA/S3KS312Y3tznV0Z37oCgYpjEoWipmLl+TPE
a3EZqYmBTudohahFT6XYylgllWMG3F7s70yVMnhXdzUKvR7FkBW1PXzl7hkNE6BJM6Vhm
jX7oOFfMNxf/hFLtqxHhksTIiVyxV2aRf8xhhtirX3q1qkppf6wHHSMQx6e+TKodWybUx
v8dD9l9fWgrZMgqD/Kz8tcsYfcBLsgtCJWMYGSqCg1iqrWkE+NXkpLSdAGEVbDgPh1MbW
mGD/UdweTmAeRiaTL0cedVxaPu/XUglox0R/GB/okkThsDdy2GpJz97IQQPokewQPTQ==
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=20260707 header.b=C3aVjpqU;
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 23E94606A32A;
Tue, 1 Dec 2026 07:55:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=C3aVjpqU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.170
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796111740;
b=gVfqebwFGauidl1Q/nNFoNFbpF2lJwonKSWXdC6Ex1HfX4nNyXF5ifiTPDu2O4sJTc70
1cBfQdvJJTf17U1LAdYz5L1IhrLxCdzHO+siBZi+z0Gx99o1jf+QVEPbVYoV1IUFh+Tm7
hAsO6FfWxWW0SqfA1QKtQm+ptckd1C7ZUCvAww36Kfn8EaRhJU86hX9NakbrXjG1htptn
O6Z2IpWqr9wpqHpSGPQbvTuX5xdblpUj+rovzAF+4pcocdMpR+xaInJtXs3WxQHlcSe85
ll6NPD2IYZnKtBUfis6Yj2h8uxYLrzLnYTXk97o4NN+wt3nkb6cT/8Oas6s8LX0gozw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796111740;
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-Transfer-Encoding;
bh=RCPP47sxEPwmydHxDeBSAihWq19vUajNGVuVIaiFTOE=;
b=Ol7AldSJg/cS1yLTPED3mGwE43h74W1BehcUscxiTQ82DHr297MWWcgLDMcO0hfyzojT
9cn2Hg4Tmr/bBvzajTVlWxGd1klAO/xKDU3J2cjH/1WzSH2XJDpcD1N7EwwuFR59YTfWX
bxNvsAjFGIAYiaaWkCFHWEpwYHfjufUe0kxEFBP5E9pnD6MQ9fXXdxDm9M3ctrnq3Q62A
SGT7x294gRqurcwdVeMWETqhj0V73jsHs6/w5f8ECXx+jRR0gu4n3s2ZW3TOUxm9zbQYX
XEHEWyqy7lwRpWm8RygGhNp1SVMzvc9iOnwLZ8Dsh/w750uXD+YDk8L5jzOMvvLq69Q==
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=20260707 header.b=C3aVjpqU;
arc=none smtp.remote-ip=209.85.210.170
X-Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170])
(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 E92CB606A31A
for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 07:55:39 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E92CB606A31A
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-pf1-f170.google.com with SMTP id d2e1a72fcca58-8c20d68c83fso6458379b3a.0
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 23:55:39 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796111739; x=1796716539; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=RCPP47sxEPwmydHxDeBSAihWq19vUajNGVuVIaiFTOE=;
b=C3aVjpqUYB07MHMdb3mT+DIyZ4PkzTvo9rvwfBI1WL1HHAO/JVUf339yD4Mmt9n8Ol
diQ2eGvv0eIvgmZLs1IXB29vjsQVmERjTS+5srjYC+2tgMZmaMiO25pM13rZ+Bc2b5hW
n7FlHlEuNBcnx0LEjCYzriw4uWjy6Y/dLUJ2zor695EIVGxpd0nYSp+FMQ2apTN0Ghwa
yY110lUhiJVqVfC/m3miUXIVygv/nHO/2jx/XcKtXNqW+FEa5qBetILrwALuo0j1+e74
iwqjTxJxOVtTRoTou1woy3FWBru1eq0miCVFjae3iV3YrHAsR4ng/pJ7AUs6OAM8GCNt
fFwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796111739; x=1796716539;
h=content-transfer-encoding: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=RCPP47sxEPwmydHxDeBSAihWq19vUajNGVuVIaiFTOE=;
b=akZq60X80KzmOsBm+CO+e88IuEfuoywzEASaKpr1X8dP+IHLBgq1JVrwehSzFuwiMH
mmlXMMOrJk7HNGBOerwXgvC5yxRjXf+E3rtt/miR1Jsgdg/dstDISybIObNxVLle4iOt
nzBsWRHvt1/lHDWpgyn9k8HJXpEKjcoQRyK30e47LKnZMBxUfX9i6Bk82ECDeTepV676
EQw3GLpdFouV6Ngm/TrORwyYKKDGhcievCLF6ETvfZOtSzkewUVL500mliSz68ooUlCa
nyWXq19mh+RReJJYVx4ioDOVzA94bfPdDZs7czvRV+EnCT8VM14rVeRKujd9qSTsJcNa
VfdQ==
X-Gm-Message-State: APuU4Z/f2q81nWAgEMwJ+OVDqEYMiyP6QQtPOVKS9Jm+dt9YGGQeiFEI
9PQABXjXukio9fX5Mws/OQODNee59WiZqaxoVfZKTDMBCkuah41uZmt3
X-Gm-Gg: AZFdTZc8MPwNUf8Y09KGG88LgkQevqWe67wpGXY3XnPt5DCMA+XYlyNqR1FmIoKUuz5
AvyeH+TrQcrQozQOsybu12H1WN0fPBJ7zqtXEFOV0YJu+7DVpMpC3NAA7gogJ/LnP8a40xK+dh5
3ES2kmpjDwoD+bPFlxQJIULWgnSmxnPiFxzLEr+XayaTF/JGfwEKr28RfIM4lhuZ88UWB4NxCX2
C5TPfIOfpHOmpQHRLVHjOLjA5AZW8hydtMhVUE+1Uw6ZPw2QANQ+XcK0O95pWSJyWFUjYbVkt0m
Mv10VQfmszWG98vFqnJsSxnXdOgPVvHWZxn1qqpjRVggSNSs1YaRdF9eVAksF5VKwYwZRZ0cCTE
+6nG+gRsh5UvtQqqJnDYXEawEfvF2EhTeb+LaIlghmZt+R8G5Arue5a3xgAot3rEB1Crd2o0n1H
ZHscDXwl6eatpcRSKnqEnOZZ375X1CR3zyJjhfkTy7Py8z7hO6z8HV90MPSYLKtKP/re/R2HxWO
HpjwoJnGzbfAbKdmMYVzik1cVPSmgLUDfjfWprtfgWWgX3h6BnO6qmd8yLqg3kmEGfvvVn6qEso
dj/hATTCFfZf++wzkn8e7DckwnEtix0dW4hIvdvIxtVST/FFG92W
X-Received: by 2002:a05:6300:4049:b0:3e2:4e6e:6ca3 with SMTP id adf61e73a8af0-4014e45d179mr27314140637.34.1796111738929;
Mon, 30 Nov 2026 23:55:38 -0800 (PST)
X-Received: from [127.0.0.1] ([43.132.141.20])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87344184fsm19733898b3a.35.2026.11.30.23.55.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 30 Nov 2026 23:55:38 -0800 (PST)
X-Cc: netdev@vger.kernel.org
X-Mailer: git-send-email 2.56.0
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