Article View: linux.kernel.netdev
Article #24616[PATCH net v3 2/5] net/sched: cls_u32: remove erroneous refcount_inc()
From: Jedrzej Jagielski
Date: Mon, 30 Nov 2026 12:30
Date: Mon, 30 Nov 2026 12:30
57 lines
11229 bytes
11229 bytes
Remove the redundant refcount_inc(&ht_old->refcnt) in the
u32_replace_hw_knode() error path during filter update.
Commit e8d3d78c19be ("net: sched: cls_u32: Undo refcount decrement in case update failed")
added this increment to "undo" a decrement performed by u32_set_parms()
on the original node's linked hash table but apparently this decrement
is already balanced by u32_init_knode(), which increments the same
refcount when cloning the original node:
u32_init_knode(): refcount_inc() on the old ht_down
u32_set_parms(): refcount_dec() on ht_old
__u32_destroy_key(new): drops new->ht_down
These cancel out, leaving the original hash table's refcount unchanged.
The additional refcount_inc in the error path has no matching decrement,
leaving the tc_u_hnode refcount permanently elevated by 1. This
prevents the hash table from ever being freed, leaking memory.
__u32_destroy_key(new) already correctly drops new->ht_down's refcount
(the new linked hash table set by u32_set_parms), so no manual refcount
fixup is needed.
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: e8d3d78c19be ("net: sched: cls_u32: Undo refcount decrement in case update failed")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260807100356.1083774-1-jedrzej.jagielski%40intel.com
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
---
net/sched/cls_u32.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index c544c8e4e876..ae1b6476f921 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -954,14 +954,6 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
err = u32_replace_hw_knode(tp, new, flags, extack);
if (err) {
u32_unbind_filter(tp, new, tb);
-
- if (tb[TCA_U32_LINK]) {
- struct tc_u_hnode *ht_old;
-
- ht_old = rtnl_dereference(n->ht_down);
- if (ht_old)
- refcount_inc(&ht_old->refcnt);
- }
__u32_destroy_key(new);
return err;
}
--
2.31.1
Technical Details
Message-ID:
<20261130123028.516696-3-jedrzej.jagielski@intel.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-374179-linux-kernel-netdev=dewy.ruReferences:
<20261130123028.516696-1-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-374179-linux-kernel-netdev=dewy.ru From: jedrzej.jagielski@intel.com (Jedrzej Jagielski) Newsgroups: linux.kernel.netdev Subject: [PATCH net v3 2/5] net/sched: cls_u32: remove erroneous refcount_inc() Date: Mon, 30 Nov 2026 13:30:25 +0100 Organization: Usenet Network Message-ID: <20261130123028.516696-3-jedrzej.jagielski@intel.com> References: <20261130123028.516696-1-jedrzej.jagielski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1427406"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Y7dqiXo+GeqlL/Zbo5+XLRz5nmU= sha256:3yUDqo6lgKeQCsQ9+gzVrfthleoYFa3A/AtAGNIXzpw= sha1:65/h1mJWwtvYNxRWDp4yjM2OuMg= sha256:ra7VYti2tTQgYmP3nfuvD6Hkw8mpEUyYi+CDuVgIGgc= 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 EA8D5125FE2; Mon, 30 Nov 2026 15:53:25 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.052 X-Spam-Status: No, score=-3.052 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, 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=intel.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 f0JKmO7XSHpR; Mon, 30 Nov 2026 15:53:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374179-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 31EB0125FE4; Mon, 30 Nov 2026 15:53:14 +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 E5E6C2E4F1; Mon, 30 Nov 2026 12:53:00 +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=1796043180; b=jvMV/VJ/dsPb/iTgs3bSq5E7P79gCacIEMaAolHigcje5C9c4nyFO4tWSSb0j6B1jwuq IuirQPxAGlEHV+fbnxkhZ0G+H8D8r6CLIm1KMFqR/cZJQZCeIlQZe1WWOrutvU7TmLCfX 2zjXJjdaT9079vgAptKU+TI4CLfkQgoe3GZOE5uHLbHyFaoHt70egLnrFXM8dgElJ98M3 YYO313EDCtD20Ek86EbzdzMA1cknJmkcjfky01nMkTcZlDNS10pBQyCun0GIjzUhne8S2 g36RHsg6sJRo3RAcmNjzFXsPPZxMXUKe0jWaiX0p29KfDBiM6YyvaF9pk9Hfcf6irbA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796043180; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV:X-IronPort-AV: Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV: 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=+VpmnhZFzEp8p6OWNFHfksbMeHhmRasmWk4QUvf2oNU=; b=xcQzxcA/vnrkollKPP01RA5fXRSC2WlqC7Pb2n2Ug/6Bq041TyMOJQ1hcRomHUrIsHOX igSuKessA0CXBdWqKRQOMcBYZlyhX0VlYLFooB3nbTE6Ky/CYqT2iFWSJrMYabcHyXUBt G+GQuVFsA8s1cxB4rpGhxv0hMJWnmh3FCYlKy+AA2xJxYeF024C1zMSXYqKscPUo/M7lk TFNfjd/l3ProtwZbTWvdz8l85duuhsqxnr8MZYtZAg99Cg5O1zicH9s5BVnw/7RXF2D+z metMHE7UpchpTRAO1sD8Cv66mQj4p5ww+wW0aeKcd8MFxUCARZmX7Kw5VNHrqNUFuJw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="YC+AUD/7"; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.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 A7FEF606A681; Mon, 30 Nov 2026 12:53:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YC+AUD/7 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.14 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796043179; b=h+HszKzQJbjo9CDCsQPUjzYw8lu3Xlwpab4ayJ+BEr5r7o8Nwuz37OFuj1PqYZr3WTg3 dMWVkWs0k9mk5cgfykVTNFXgatkFah3z0ZF7xMbxxRwl4U/R2GUIURHi46f433pzX7Qen KZO0FqznVTY0TIOMGnQPTaEUiOpReqWvNvrWlkTwRlNtmAf0a+rZ16lTDp4h8A/T4zHjY wINNrcQ9uPsuxbOeod38Hh3+QbVMw7KvqqL5svvLtJW5qlXC5hWkbhLSwnWcVTZ7cAzJI PRvwH7KK4Py7x3W8OugcAXu+KOxbT42cgJhvCzoejFEnAnL3/Eeum39GcsuZsLCE4rQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796043179; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=+VpmnhZFzEp8p6OWNFHfksbMeHhmRasmWk4QUvf2oNU=; b=phV/ytB9FwzXfffC9z+PYiy6yyOxgIfXBGHTSpFlfUlFevFRwoCzEIICCxUGzTEpyOYg JW7dXzVz/x25pssiBGly69DSCcJcYHDNiksxoruyU6G0TYrN94oWJ6A1oWbg1/VYXw//Y bHuxdePqYK361OHGRbs4HL7nyYHN0upupwPdmlLMXm7WTm9NjJ//pbVKqTEw22WCd6pmj 3vKeh2YK7FTpWwaWz1PW4JaZilbt4NdCRaIfrB/1YRnIH3aoPifUhZ2WGHvrpMaVM39yh mFcjP8mUgM8LmzxepQZGSTtqQBU4wLKg0EIkD/ZQd+gdaw0v6WkeDzgMiZcPnl+QG4g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="YC+AUD/7"; arc=none smtp.remote-ip=198.175.65.14 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75C5F606A31C; Mon, 30 Nov 2026 12:52:59 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 75C5F606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796043180; x=1827579180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+VpmnhZFzEp8p6OWNFHfksbMeHhmRasmWk4QUvf2oNU=; b=YC+AUD/7K9Ect1Dd47vcyhjF5hlmeAFZTBh1V2nYB8EGBlfzCiCOG7Xj IhE1Oo+E/QLJWtHE0LNnreES0qm2gq1fsnfDBBRvDVQYpjbqQLA05NkNn io2WcpVm1b0ozWKWWmiSLz8DxXgBCvymgGs1HnBUNuq1BClovVP1I27oX Yz83EnmEaLryss6pfunDT+da0pBETXGTw72lCgVNgxhbqWeuZwICBeIi2 Sc5hDrIHWH3zNS4I+hgMUehHYQL1m5iJxNCRMKuvbe72ZYaqzAIew1hup efU6HDxY71jGIfYpcJ8ugTElsFAsaNKYAQnrA6nXGCvbcptqsQv9NDquX g==; X-CSE-ConnectionGUID: gm0Y+1/ZSZuoGP2n10zNcg== X-CSE-MsgGUID: ExVx8PG5TzKIw/JIUGBzCQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4778583" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4778583" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 04:52:59 -0800 X-CSE-ConnectionGUID: bzGsY1qlSra6aLW4gMu0UA== X-CSE-MsgGUID: RaZy95cgQF26jcpPVhVf6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="12957204" X-Received: from os-delivery.igk.intel.com ([10.102.18.218]) by orviesa002.jf.intel.com with ESMTP; 30 Nov 2026 04:52:57 -0800 X-Cc: anthony.l.nguyen@intel.com, kuba@kernel.org, jhs@mojatatu.com, jiri@resnulli.us, edumazet@google.com, Jedrzej Jagielski <jedrzej.jagielski@intel.com>, stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org> X-Mailer: git-send-email 2.31.1 X-In-Reply-To: <20261130123028.516696-1-jedrzej.jagielski@intel.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