๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25266

Re: [PATCH net v3 1/5] net/sched: cls_u32: fix linked hash table refcount leak

#25266
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 12:54
68 lines
10519 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message calls the fixed path "currently dead code"
  that only becomes live once "net/sched: cls_u32: feedโ€ฆ

--

net/sched: cls_u32: fix linked hash table refcount leak

This patch drops the reference on n->ht_down at the errunbind label in
u32_change(). With it, a failed u32_replace_hw_knode() call no longer
leaks the refcount on the linked tc_u_hnode. The commit message calls this
a forward fix for an error path that can't be reached yet.

> This is a forward fix for currently dead code, which will be uncovered
> by the upcoming patch "net/sched: cls_u32: feed u32_replace_hw_knode()
> with correct set of flags".
>
> Fixes: d34e3e181395 ("net: cls_u32: Add support for skip-sw flag to tc u32 classifier.")
> Cc: stable@vger.kernel.org

[Severity: Low]
Is "currently dead code" accurate for every tree the Cc: stable tag will
reach?

In mainline the path does look unreachable. u32_change() passes the
kernel request flags (TCA_ACT_FLAGS_*) instead of userflags:

	err = u32_replace_hw_knode(tp, n, flags, extack);

So tc_skip_sw(flags) in u32_replace_hw_knode() is always false. That
means tc_setup_cb_add() runs with err_stop=false and returns 0.

Before 695176bfe5de ("net_sched: refactor TC action init API") in v5.15,
u32_change() passed the user flags directly:

	flags = nla_get_u32(tb[TCA_U32_FLAGS]);
	...
	err = u32_replace_hw_knode(tp, n, flags, extack);

In a tree like 5.10, take a skip_sw filter with TCA_U32_LINK on a block
that cannot offload. tc_setup_cb_add() then returns -EOPNOTSUPP. The errhw
path frees n with kfree(n) but never drops the refcount on n->ht_down.

After that, refcount_dec_if_one() fails in u32_delete(), so deleting the
linked hash table returns -EBUSY. In those trees, anyone with
CAP_NET_ADMIN in a network namespace can trigger the leak today.

This patch also won't apply there as written. v5.10 has no errunbind
label and no u32_unbind_filter() call, so it would need a manual
backport.

The enabling patch named here would carry Fixes: 695176bfe5de, so it
won't reach pre-5.15 trees either. For v5.15 and later, the dependency on
that companion patch is already stated clearly.

Could the commit message mention that the leak is live in stable trees
older than v5.15? Otherwise, someone handling a failed-to-apply stable
report could drop this fix for 5.10, the one tree where it fixes a bug
that can actually be reached.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130123028.516696-1-jedrzej.jagielski%40intel.com
Technical Details
Message-ID: <179612968645.3146.10471010351182445151@kernel.org>
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-375070-linux-kernel-netdev=dewy.ru
References: <20261130123028.516696-2-jedrzej.jagielski@intel.com>

Show 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-375070-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/5] net/sched: cls_u32: fix linked hash table
 refcount leak
Date: Tue, 01 Dec 2026 12:54:46 +0000
Organization: Usenet Network
Message-ID: <179612968645.3146.10471010351182445151@kernel.org>
References: <20261130123028.516696-2-jedrzej.jagielski@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1714180"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:OxHlN41fEmvqJ0WWKLLcHaFqulQ= sha256:Hyum95PWvf/0MoQI3BwU/fNmj69/B993GzufGTa7mSw=
	sha1:9tM4xiV66fH0N57ng8kb7iEmdJs= sha256:H5aHUQ5dDKzFs2zNH3WS9rov9RBQxWZuStBzX99dVys=
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 7AE9011739E; Tue,  1 Dec 2026 15:55:10 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 wsxydK4veJkY;
	Tue,  1 Dec 2026 15:55:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375070-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 51F8B11739B; Tue,  1 Dec 2026 15:54:53 +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 8992120B7A; Tue,  1 Dec 2026 12:54:51 +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=1796129688;
	b=ia50HP5GhDHQYQLHBbTZjrZBRPMf+5lwfPr+WwJK2GpxQjvKZ0kfq4dWLrlIelPPNjIH
	 BOVk7CtVUoGyL287/66mluqytGWcHecVlGlq7vRnruWAlNEF4wQDMBABgJQsDbvLpXQ5s
	 +UKgZ30V313jtntJ5QJYCzmUCy1v/SyX6n5OjjiagqnOQpMYh5twP146gqhoXady+eusr
	 wOAYxBXZ+lU5gmhd9PFFvjVqahjRbl4FhuUrsswrZ7QrlHlFC2FoMbwjqjOFZMEuanbnC
	 6hHDKOFMfAhqy+o8AHy3tUXcqaMWn7hrB3CuHnuwGn9xRc8DbZnG1wT+pQAcm/0Kl2Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796129688;
	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=IdRotYTQj4b4sEyd/qvmk0KwjMLzg9vj+UPhIRPAAP0=;
	b=4wYjmXqHYNUwHCaf3ffg+osMTZuEsjEpYtdDEL5oTz84+Jv6GRatp+sZZaYPv0kecY34
	 syYJbLJP94T2dwqwVI8yP2VN9K++RVcH/1Gvn1V2SDyvyv4K+SAEbuTOcrwO5q5J4T4T4
	 GslhVoe3rBnt2TIFO7I+hlon/Tbo+qZxz3ysQ6xBCj4NtCFZL/C+2UiPEWQNvlqafpTIG
	 WkQod3dAAv4jcZdFqBtwfYsLUkJo33n9u5Fswev4586zGFRpGMkt5a5Si/qdOvUCbdG4R
	 M9Q04NX4GprnCkDl+4a+KLjYsN8SurEqiatg93domW9Y3UnAzEfxiwDdA/q3c8dWXrg==
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=VqUGi5ut;
	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 AD2CC606A32E;
	Tue,  1 Dec 2026 12:54:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VqUGi5ut
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=1796129687;
	b=EUp2WnxNCB/u/N3fd+h99YUaL1mze6huhrYBNvpajihSoHriSLSLSfzHZnS8sYmHu6tK
	 bhX+dOpXJlyb6cEL9YaOVvB1SsDfUyNAp0xFUlkLmu3D8wfZX5a2vt8fRC2827UarTGcd
	 LNWrmg2oM/gGYWaAgOqz0jO4gobfCMn0JZFOhNOwqYKhxwNIgQDM6x+MvhYzuNbAZguqw
	 21s0FaQ5l2a6Iyif2wELx3lxkqO9IP+08a2wG1JlDNMp04mZxna3GxFVg9sL81+JSimdT
	 VrAKmn/WYQIRtY4CJbuHvgv5W4yLxgjW+aqktGAqfh+Y55ynaa+2ByFl0gpA0YSpliA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796129687;
	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=IdRotYTQj4b4sEyd/qvmk0KwjMLzg9vj+UPhIRPAAP0=;
	b=fz2kXM7MnVKqkzgnVR8SitMiQS4nCU+MBq4IyqPfjz2aw55lJyE/HtevHcJAhPkq+Ooi
	 51xhhWnNRm9KmY+pfHwlOc0i2mX82ga/b3Pl5PR1vINyOiADp/J0MQr9fMT+sS6kbrb/M
	 r3p+Gz7UQyoUXg4OxZ+Q4Kkl2JoTTMC/H45aYdaomQva0ytXQX2Vr4NtBqWnnzSVfSt16
	 BELrKPjZjya76qnylPC10pm43xEI6iQCoxzkg0mLx/J4S1MdelU/2ThCpF2zki0Xj8Q7O
	 oah1XfbUDfPho796FMIAIjSUk0vFL7otyn7z961r1fiqJITti5CcvelQs6Tn7rvzlnw==
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=VqUGi5ut;
	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 C9F4F606A31A;
	Tue,  1 Dec 2026 12:54:47 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E566E1F00893;
	Tue,  1 Dec 2026 12:54:46 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796129687;
	bh=IdRotYTQj4b4sEyd/qvmk0KwjMLzg9vj+UPhIRPAAP0=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=VqUGi5utNrZopracZUwWbL/rHpyfIVHGCkAFsVK/S6gXlAV/kskVr6Cx2xCyRpkJt
	 JMedk1XA1jitxqBzydtlbfz2SipI973jLtf6/sdSZtNTOpQBY+OMtdssxNMLuo7sAy
	 37wHC0cFKaDwDfJQi7aTF7ijo3w2Zw+/yulBRbzGdLgZcmizuzhwnFlJKT3g5UP6Sd
	 rSSTaUF1nUrpK6rqpqaTZYMD3FHdwPitD4norzs0m9mCdpxS3cqnRIBKprCBv3i5dr
	 tGfaNhYBAEhEyjeOf+zsjmuWVUePDSWZroIgHBw2Oxs8Bn6y6poK5N688wgtuPOTTV
	 LmyoJxEeNil9Q==
X-Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, kuba@kernel.org,
 jhs@mojatatu.com, jiri@resnulli.us, edumazet@google.com,
 stable@vger.kernel.org, sashiko-bot@kernel.org
X-In-Reply-To: <20261130123028.516696-2-jedrzej.jagielski@intel.com>
X-sashiko-severity: Low
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