๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25267

Re: [PATCH net v3 4/5] net/sched: cls_u32: feed u32_replace_hw_knode() with correct set of flags

#25267
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 12:54
124 lines
12367 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] This patch passes `userflags` into u32_replace_hw_knode(), so
  a `skip_sw` knode now reaches tc_setup_cb_add() with err_stop=true.

--

net/sched: cls_u32: feed u32_replace_hw_knode() with correct set of flags

This commit passes the parsed TCA_U32_FLAGS value (userflags) to
u32_replace_hw_knode() instead of the TCA_ACT_FLAGS_* flags argument of
u32_change(). With this change, tc_skip_sw() sees skip_sw and the offload
path honours it.

> diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
> index bf4dc4244b84a..48c581d6830c9 100644
> --- a/net/sched/cls_u32.c
> +++ b/net/sched/cls_u32.c

[ ... ]

> @@ -1194,7 +1194,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
>  		struct tc_u_knode __rcu **ins;
>  		struct tc_u_knode *pins;
>  
> -		err = u32_replace_hw_knode(tp, n, flags, true, extack);
> +		err = u32_replace_hw_knode(tp, n, userflags, true, extack);

[Severity: Medium]
With skip_sw now reaching tc_setup_cb_add() as err_stop=true, the error
branch in u32_replace_hw_knode() can run for the first time since
695176bfe5de. Can that rollback remove an unrelated filter from hardware?

net/sched/cls_u32.c:u32_replace_hw_knode() {
    ...
	err = tc_setup_cb_add(block, tp, TC_SETUP_CLSU32, &cls_u32, skip_sw,
			      &n->flags, &n->in_hw_count, true);
	if (err) {
		if (new_handle)
			u32_remove_hw_knode(tp, n, NULL);
    ...
}

u32_remove_hw_knode() sends TC_CLSU32_DELETE_KNODE through
tc_setup_cb_destroy() to every block callback. That includes the driver
that has just rejected the add and never programmed the knode.

In ixgbe, the driver named in the commit message, root table knodes
(uhtid 0x800) are deleted by slot alone. The child_loc_map ownership check
is skipped:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:ixgbe_delete_clsu32() {
    ...
	u32 loc = cls->knode.handle & 0xfffff;
    ...
	if (uhtid != 0x800) {
		...
		if (!test_bit(loc - 1, jump->child_loc_map))
			return -EINVAL;
    ...
	spin_lock(&adapter->fdir_perfect_lock);
	err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, loc);
	spin_unlock(&adapter->fdir_perfect_lock);
    ...
}

ixgbe_update_ethtool_fdir_entry() then erases the FDIR perfect filter at
sw_idx == loc, whatever it is, and frees its fdir_filter_list entry.
Ethtool ntuple rules and u32 knodes in child hash tables use the same
sw_idx space.

As an example, an admin could first add an existing rule in slot 5 with
"ethtool -N ethX ... loc 5" or a u32 filter 1:0:5 in a linked table. Then
they could run something like:

  tc filter add dev ethX ingress protocol ipv6 u32 handle 800::5 ... skip_sw

The call chain would be:

u32_change()
  u32_replace_hw_knode(tp, n, userflags, true, ...)
    tc_setup_cb_add(..., err_stop = true, ...)
      ixgbe_configure_clsu32() returns -EINVAL (protocol != ETH_P_IP)
    u32_remove_hw_knode(tp, n, NULL)
      tc_setup_cb_destroy()
        ixgbe_delete_clsu32()
          ixgbe_update_ethtool_fdir_entry(adapter, NULL, 5)

A mask that differs from adapter->fdir_mask, or an action rejected by
parse_tc_actions(), would hit the same path. In each case
ixgbe_configure_clsu32() fails before it touches the hardware.

The tc command fails, as the commit message expects. However, the filter
that was already live in slot 5 also seems to be gone from the device.

If slot 5 belonged to another u32 knode, the software side would still
report it as offloaded (TCA_CLS_FLAGS_IN_HW, in_hw_count, child_loc_map
bit). If that knode is also skip_sw, its traffic would no longer match in
either software or hardware.

Before this patch, err_stop was always false. tc_setup_cb_add() returned
0 and this rollback never ran. Since the patch is Cc: stable, would stable
trees pick up this behaviour as well?

Should the rollback only notify callbacks that accepted the add? Or should
ixgbe_delete_clsu32() check ownership for uhtid 0x800 before it erases
the slot?

>  		if (err)
>  			goto errunbind;
>

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130123028.516696-1-jedrzej.jagielski%40intel.com
Technical Details
Message-ID: <179612968754.3146.9944840736432058737@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375071-linux-kernel-netdev=dewy.ru
References: <20261130123028.516696-5-jedrzej.jagielski@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375071-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 4/5] net/sched: cls_u32: feed
 u32_replace_hw_knode() with correct set of flags
Date: Tue, 01 Dec 2026 12:54:47 +0000
Organization: Usenet Network
Message-ID: <179612968754.3146.9944840736432058737@kernel.org>
References: <20261130123028.516696-5-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="1714228"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7+eHc8twPZlaYA1YpoBEoK/vdxg= sha256:wMsmhw2g2+TgpJWocnW20yWI1iZfZ2ZxBZp8f3hYVdg=
	sha1:UssAEnGz2yqADil3kjl//pIjyrY= sha256:9QONxnj3u7wk5HV7MjobG7iLmgLasIthhBBpUKeXS4Y=
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 DF10011739B; 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 Zk2HTlXDlPi7;
	Tue,  1 Dec 2026 15:55:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375071-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 01D9311739C; Tue,  1 Dec 2026 15:54:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id DC38C26AEC; Tue,  1 Dec 2026 12:54:52 +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=1796129689;
	b=fknVE08syNVkMSbh7sRYEvPHwxuyUcaKVv60WaJkB3w6HXtvTbTPtOp1q8WSltXZEOd5
	 kDJ7fn+Z4zYxYkWW1ijSWNEWWEnwgkbig7H99KpyqpWMbf9ocEAGuN1EXQ9AbZp9i+OY4
	 4ba6PRemJsPOvQZeu/ymCk2CYc4Wt8IoynfSvBcx1yefzQ+yCnWDQbOKuWPtLQURZKHsu
	 OIY+ugOG1GSwglnafJpTrH6inGAXCSOLLJlWSI9qET0hGbq7eo+NKV8DC2XwxFey8yXe8
	 0W24J6CR6yZx62mDnV3LDPqEq433ukFzLObGxl13W608N2cZ7PW3+Gff4pyElq6HmSA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796129689;
	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=sfw5YYiS/QmcZ4dfmIEl8J+iGgI86wpEkWkivmzNQxI=;
	b=he+XAEHMOFR4QoH+3o84ya4AwpnsNbN7RXB87dtCDrC+k56b88lp7r8NZ6aWYJ8ywfLb
	 YshnbdAEuzNuyMYjSIcPjB/L3SP3HbXVWetSJlbI1LA/zMnRDHllrBrUUbu9h1HK2Z5VV
	 rIscTBSgal1OVJRF3C76hpFVvQMfHIfCdFxYTKgc7nXz1m08PqgbP6HdwsBNuFx7X/WwA
	 4haPXOq1zDqck1MaqSj2yZmJ52KkxHRERUK2RcWA8ICLFrWhoxWiB1WLV6aefxr0uclhg
	 j2arnRVHqe8wQ08QbL7X+dfR6vuhYgG/JWQJ1czUFpJoignL9gooW3WY8eyYuqavIAg==
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=ZMQmNSrW;
	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 BAD64606A33A;
	Tue,  1 Dec 2026 12:54:49 +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=ZMQmNSrW
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=1796129688;
	b=e2/Xiz/SeeYNJ9jo8/Wo93vHvhEkgwDPCtE0+i+xic5fkoQ4MV2m8bay/Cq+AMIHi/no
	 eqqb+Yznuxv4Ei+y57ilir4Xtu8xRF3OOcQGqOO64rZ67fbtNH8CZLep5wNzlzyxuPPH5
	 CVvx1HZYZXioQAmEQxJkvhVSdUbB6Ghkvh3a62Jkn5gmmNomEnXDbRMmHP/qE/g37uszv
	 +jkU5H5AN3WMJKJlNJbOKiLdttImGICfY0fUYEI+bmvOCAnmj8S7nFM4CCGPqZ7mOoOnU
	 Y3ttnCcHylQnKBNSYkrKrJgEJmUKrC/+PfFyFZxRWrlsYQzc/DateX7D1GPiCOoGIaQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796129688;
	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=sfw5YYiS/QmcZ4dfmIEl8J+iGgI86wpEkWkivmzNQxI=;
	b=bRbEB0lAuCQReKruY6aIramqd02eWzgcGtwcUkle8nm3tVmzuiNQBzDMJ4/qFKQCTE9i
	 L1aI6mYrzyjPObZggbiW8y9j4N+RNc3cEqC6nwmpF8fkJpe5B8FUELYCrpynkpe/n9vRa
	 l0ZevRDQG6AU/GIRPoTxgjP/QtCSHUOJQ/BrEWSiYlvoZ4Ophm/skODdrR7NsToRn7qRF
	 /gLa75kvI3e1YL1FoA6k4HrNEjSLrYUzFBH6Q2WYS+LCiE+vipX/NHHNocXWp3diqA+EM
	 56EZXryeM/GssTH1A+8dCYH2yLFS2ZYa8307kiFokDfywu9uLoQi/2HQwsHO6qOFMiQ==
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=ZMQmNSrW;
	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 D5AC1606A330;
	Tue,  1 Dec 2026 12:54:48 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EACE01F000C1;
	Tue,  1 Dec 2026 12:54:47 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796129688;
	bh=sfw5YYiS/QmcZ4dfmIEl8J+iGgI86wpEkWkivmzNQxI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=ZMQmNSrWvsbJicgNE9+tqkaA54Rqy4a8lHEs6Seto+Rifq0QhtELQG5l1XF3t4PoP
	 JLmmdvgXP5QivNVQCfvWLvXH18IbnATYx0uKCclthlCrxQoYAmEbLHkik1iQNVVvLm
	 dsYhxTuKGyCJzOewTeQ5rUkHRgdxTTrIHuTRlio269bLzQK2jcpJChTGiJ4hoInkzE
	 oL/lF/SQ/tKNdV8CoPipMgiyeyDe/NoFSd6tcxYJVVlyya3HmIFsey9lYVLVM+hVJB
	 nnkbRblyMjT9fEvMg0mWOUmYnoywVP3xVsGwx6TME63UAjFfmnYSurThfVPFDXNk03
	 SsL1PyCQ6d34g==
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-5-jedrzej.jagielski@intel.com>
X-sashiko-severity: Medium
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