🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24614

[PATCH net v3 0/5] net/sched: u32_change() fixes

#24614
From: Jedrzej Jagielski
Date: Mon, 30 Nov 2026 12:30
59 lines
11163 bytes
Hi,

This series fixes four bugs in cls_u32's u32_change() function:

Since commit 695176bfe5de ("net_sched: refactor TC action init API")
u32_change() passes TCA_ACT_FLAGS_* instead of the u32 classifier flags
to u32_replace_hw_knode(), so skip_sw is ignored when offloading u32
knodes: tc_setup_cb_add() runs with err_stop == false, driver errors
are swallowed and a skip_sw filter that cannot be offloaded is reported
as successfully installed, while it matches neither in SW nor in HW.

Patch 4 fixes that. Doing so makes the error paths of
u32_replace_hw_knode() in u32_change() reachable again. They have been
dead code since 695176bfe5de and contain bugs, which patches 1-3 fix
first:

Patch 1 drops the n->ht_down reference at errunbind, which leaked the
linked hash table when offloading a new knode with TCA_U32_LINK failed.

Patch 2 removes a refcount_inc() in the replace error path, which
"undid" a decrement already balanced by u32_init_knode() and leaked a
reference on the old linked hash table.

Patch 3 stops the rollback from sending TC_CLSU32_DELETE_KNODE on a
failed replace. The new knode shares its handle with the still
installed old one, so the rollback removed the old HW rule. It also
documents the trade-off for blocks with multiple offload callbacks
and hints userspace via extack that HW may be partially updated.

Patch 5 adds a tdc test checking that a skip_sw u32 filter is rejected
on a device without offload support.

Note that with patch 4, skip_sw add/replace commands which cannot be
offloaded now fail with -EOPNOTSUPP/-EINVAL instead of silently
succeeding.

v2:
- add fixes for 2 preexisting issues uncovered by the initial fix
v3:
- reorder: fixes first, skip_sw fix after them, so no bisect point
- add 'don't remove old HW rule on failed knode replace' fix
- add selftest
- alter cover letter content

Jedrzej Jagielski (5):
  net/sched: cls_u32: fix linked hash table refcount leak
  net/sched: cls_u32: remove erroneous refcount_inc()
  net/sched: cls_u32: don't remove old HW rule on failed knode replace
  net/sched: cls_u32: feed u32_replace_hw_knode() with correct set of
    flags
  selftests: tc-testing: add u32 skip_sw test

 net/sched/cls_u32.c                           | 26 +++++++++----------
 .../tc-testing/tc-tests/filters/u32.json      | 22 ++++++++++++++++
 2 files changed, 35 insertions(+), 13 deletions(-)

-- 
2.31.1
Technical Details
Message-ID: <20261130123028.516696-1-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-374177-linux-kernel-netdev=dewy.ru

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-374177-linux-kernel-netdev=dewy.ru
From: jedrzej.jagielski@intel.com (Jedrzej Jagielski)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 0/5] net/sched: u32_change() fixes
Date: Mon, 30 Nov 2026 13:30:23 +0100
Organization: Usenet Network
Message-ID: <20261130123028.516696-1-jedrzej.jagielski@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1427310"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0tTeZNHNmrcg6YlhKu6pZym+fHs= sha256:0YewjKo5bro9+lbV/b6MBiUYOYrqOHQ0nPtXrDhUZXE=
	sha1:esZp8bqgrU0/2zJ9zCBhhZpLMZA= sha256:LA2wFpPqsH7JMRUGK7jwaVSAaYu7+isgt2IaF/0ff44=
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 B75EF125FE5; Mon, 30 Nov 2026 15:53:19 +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 OayAJ35cVZbu;
	Mon, 30 Nov 2026 15:53:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374177-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 35FC3125FE1; Mon, 30 Nov 2026 15:53:01 +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 EBEA62DC50; Mon, 30 Nov 2026 12:52:57 +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=1796043177;
	b=tLVRuAYbR9ua2AyljqLXWHHZMk8qdDnI+UNBrrPmfT2Yok1Nxv1m9Hh3D7Cwy4+Qu6ya
	 QMKSLUhbQkmeDlIFRxLqpskAKSJaLb5GT9Rlgin78TP0euPWOsmq6fmoLnQvcrh17VKAg
	 gNS4Nk4liRhy4vCM7UeTXkTi0eXK8qRT2LUgVDq+lQv7z/LLSEVyXzWa49qYWDLrV2LUJ
	 gLvTZwZ+JHSHUXZ1Skgy/fj7bQQRwB3gnOVC6AH7zh9hU595by8JubXDCEWofzDK9Wquu
	 8xwRqd3w0b+3rcdnKVanusZS5KwxBcmDRRi2T+b1UvNHGk+Fua2XUAc6ErvSnky4gqA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796043177;
	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:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=tzt3QI6KNzkjU22dtFG6VH7UQ1z/gRDO4+EgeaMYzMo=;
	b=W51Tkt1KDtC3e26tX+DhIKjZYaxKEkFIsvB3YNFVXQwCvvhDWHabcTjl0B3LlXCBO4RJ
	 rxPLgUkzKSlbSuFKEd0Ihy0L+mN14fAK4DFPrJCWNHlIiF+AtBtePGHuOFI2Ef/p4lI4d
	 5s9qgjRbZa6GScanTBz3uj371mdia0xLQ0fesJBz03LXGE+YtG5XRsdTISFUqzry+anmA
	 +O8Wk2uwi1M+AEV+4j9vfzMmuI3UMrIxhUGreuEaL+SPvBT7SPIXi820TAfIpMoj7q/nO
	 Giekj8Ox0co4i/hN4FMc547wV+4WDuJP7wXFAlXo4NMXhwZ9RqxMR8hae9uVhhUyxDw==
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=Tl57InUp;
	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 80270606A336;
	Mon, 30 Nov 2026 12:52:57 +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=Tl57InUp
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=1796043176;
	b=tmUVQsiqskq66MUHOkarYG6NViLfeRr2qRwqwDWlmF+MKLQTX3/aQnEKl+sJ3hwPSMDE
	 uoS5bZ9MOs7nv65D8t+O7+ZTqIVThoQX9K6pTYMCLJPQbjP7q58mCoblEvlFN2iuoWajo
	 YzQRpQQvup1+/ge31rLL3PHNPvx6oBRQykdtzE60z87x28ZpxoGMug0NG0EBVyfcNgBKi
	 CvItyDRceI8TqfeYjWbTKz3eHG3jv0wvGuaBjk6XCvPhni5vScreHeZxMwNS0kkgsJ8yQ
	 fdcb8U8Rp2aWm9RY0yHb9s1LhfDT1cFNC8EqK0CSrzITk9J8LB8RWL5GRnI++SUncJw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796043176;
	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:MIME-Version:Content-Transfer-Encoding;
	bh=tzt3QI6KNzkjU22dtFG6VH7UQ1z/gRDO4+EgeaMYzMo=;
	b=hQ4fKS3Ktd8Ihug8H+JRsdK2xqOx/5bZQIMzxHRIgXM4VaGmb824kXQUo1IUHuwmG/Yo
	 aSj9cPvEr3g1X4J42oHONhhHTVPDlTGgg08TyAn1tO1oxoNVXkVX+6Sr3hZWgfiN9khAb
	 mXpGxSb47H9SiOhZ8WQF9MBehPK/fzP+EIHqe9Cu5ZhLSo+8RS9aw5SJHeV1z24S5lZib
	 /1lKc2iNzDGp2we219kqhN0p+UG0ZFNScNdrpVjTHsjQcMbmAPqkGOq5s665E7tPm0OE8
	 zST6wqZm5E6ruGiydgoMz8qg1nPstgXJQM48fUTnLeCQ1BFEIDwrf4dI4ZYnZQV3fUg==
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=Tl57InUp;
	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 79EF5606A320
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 12:52:55 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 79EF5606A320
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=1796043176; x=1827579176;
  h=from:to:cc:subject:date:message-id:mime-version:
   content-transfer-encoding;
  bh=tzt3QI6KNzkjU22dtFG6VH7UQ1z/gRDO4+EgeaMYzMo=;
  b=Tl57InUpts/E/xKWT+BBe0cQReF3muTkDjTCWYMUm400zDWx/1QwcjsD
   gklQzCF2ZyQzgNDPnve/57WCNg2rCZJOMaciALTrQlYUnb6FmFbRe6Tex
   nlam0w0Ttv1oCsC048wbYdPS8TSFbtpVQsq2KdNQjP2Q3bc5HagMIrMOk
   B4vJuJ+BL+l2TX8HAlKN78vspsQogZdHyntsO/YQhm3wX3w2N59+GorSR
   I14zoaEASLIX7H8GX7RPenu2RZEeZBrd9yh42Jw2rTB8kwvatolSA+Ni/
   Tn3q5TDMsW7FXEzwDjO7Ki+rpuSE5s1Ii6eVMAILwP/S6fPtPiZPpffMU
   A==;
X-CSE-ConnectionGUID: WKw7EQU4Tl69xzR7vyk/MQ==
X-CSE-MsgGUID: JbXruRmSTr+LrCPQyNE22Q==
X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4778557"
X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; 
   d="scan'208";a="4778557"
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:55 -0800
X-CSE-ConnectionGUID: NcOcTBXuQce4zPFGLzLPUA==
X-CSE-MsgGUID: VDr74KXQRWyJX7M7xhGPpA==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; 
   d="scan'208";a="12957161"
X-Received: from os-delivery.igk.intel.com ([10.102.18.218])
  by orviesa002.jf.intel.com with ESMTP; 30 Nov 2026 04:52:53 -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>
X-Mailer: git-send-email 2.31.1
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