🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26293

Re: [PATCH net-next v3 3/5] net: dsa: motorcomm: Reject isolated redirect targets

#26293
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 11:15
144 lines
13794 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

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 decides once, when a filter is added, whether a
  redirect is programmed as hardware REDIR, downgraded to TRAP, or (for…
- [Low] This patch carries `Fixes: 8eb9e7520b17 ("net: dsa: yt921x: Add
  ACL support")` and will be picked as a stable candidate.
- [Low] The new check `pp->isolation_mask & BIT(to_dp->index)` in
  yt921x_acl_rule_ext_parse_flow_action() fires for more than…

--

net: dsa: motorcomm: Reject isolated redirect targets

When parsing a tc redirect action, this patch checks the ingress port's
isolation mask. If the target is isolated, skip_sw rules are rejected.
Other rules get a new sw_assisting flag, and yt921x_acl_commit() uses it
to program the action as a CPU trap.

> diff --git a/drivers/net/dsa/motorcomm/tc.c b/drivers/net/dsa/motorcomm/tc.c
> index e3f057ed580f5..b7fe867da0882 100644
> --- a/drivers/net/dsa/motorcomm/tc.c
> +++ b/drivers/net/dsa/motorcomm/tc.c
> @@ -1030,6 +1030,7 @@ yt921x_acl_rule_ext_parse_flow_action(struct yt921x_acl_rule_ext *ruleext,
>  	const struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
>  	const struct flow_action *flow_action = &rule->action;
>  	struct netlink_ext_ack *extack = cls->common.extack;
> +	struct yt921x_port *pp = &priv->ports[port];

[Severity: Low]
This patch has a Fixes: tag for 8eb9e7520b17 ("net: dsa: yt921x: Add ACL
support"), so it is likely to be picked up for stable.

It reads yt921x_port::isolation_mask. That field does not exist before the
previous commit, "net: dsa: motorcomm: Cache port isolation masks". That
commit has no Fixes: tag and no stable dependency note.

Would a backport of this fix build without that prerequisite? Could the
dependency be annotated so both commits get picked up together?

[ ... ]

> @@ -1072,6 +1075,20 @@ yt921x_acl_rule_ext_parse_flow_action(struct yt921x_acl_rule_ext *ruleext,
>  				goto fallback;
>  			}
>  
> +			/* Port isolation takes after REDIR judgment, but
> +			 * software delivers such frames.
> +			 */
> +			if (pp->isolation_mask & BIT(to_dp->index)) {
> +				if (cls->common.skip_sw) {
> +					if (to_dp->index == port)
> +						reason = "Redirect to self, which is not hairpinning";
> +					else
> +						reason = "Redirect target isolated, or not in the same bridge";
> +					goto fallback;
> +				}
> +				ruleext->r.sw_assisting = true;
> +			}
> +

[Severity: Medium]
This check runs only once, when the filter is added. The result is stored
in sw_assisting, or for skip_sw it decides whether the rule is accepted.
yt921x_acl_commit() turns sw_assisting into the YT921X_ACLn_ACT value, and
it only runs on rule add and delete.

What happens if isolation changes after the rule is installed? In this
patch nothing re-checks the decision on bridge join, bridge leave, or a
BR_ISOLATED / BR_HAIRPIN_MODE change. A REDIR into a port that becomes
isolated later would still be dropped by hardware.

Two later commits in the series cover most of this:

  "Reject bridge flags that break redirect rules" refuses BR_ISOLATED and
  hairpin-off changes while skip_sw rules depend on them.

  "Recompute redirect rules on bridge changes" re-checks non-skip_sw rules
  on join, leave and flag changes.

Even at the end of the series, skip_sw redirects still don't seem to be
handled on bridge leave. yt921x_acl_recompute() skips them:

	aclrule = aclblk->rules[i];
	if (!aclrule || !aclrule->sw_assisted)
		continue;

Meanwhile yt921x_dsa_port_bridge_leave()->yt921x_bridge_leave() rewrites
the isolation masks:

  yt921x_userport_standalone() sets the leaving port's own mask to
  ~dsa_cpu_ports(ds).

  yt921x_isolation_calc_standalone() sets the leaving port's bit in every
  port's mask.

For example, with lan1 and lan2 both in br0:

  tc filter add dev lan1 ingress flower skip_sw ... \
      action mirred egress redirect dev lan2
  ip link set lan2 nomaster

The REDIR action stays in YT921X_ACLn_ACT while lan1 now isolates lan2.
Matching frames are silently dropped, and tc still reports the filter as
in_hw. The same thing happens with lan1 nomaster or ip link del br0.

This patch refuses exactly that setup at add time, with "Redirect target
isolated, or not in the same bridge". A skip_sw self-redirect on a hairpin
port that leaves the bridge looks like it would behave the same way.

The comment above yt921x_acl_recompute() documents this as a limitation,
because port_bridge_leave() returns void. Would it be worth at least
printing a warning when a skip_sw redirect is invalidated this way, so the
drop isn't completely silent?

[Severity: Low]
This isn't a bug, but the isolation_mask test matches more than BR_ISOLATED
ports. It also matches targets outside the ingress port's bridge, including
two plain standalone ports. yt921x_userport_standalone() sets
isolation_mask = ~dsa_cpu_ports(ds), and yt921x_isolation_calc_standalone()
sets each standalone port's bit in every mask.

So standalone-to-standalone and cross-bridge redirects are now rejected
with skip_sw, and trapped to the CPU without it. Given the hardware
behaviour the commit message describes, hardware was already dropping these
redirects before this patch, so the new behaviour looks correct.

The commit message only mentions "Port isolation". Could it also say that
bridge membership now decides whether a redirect is offloaded? The extack
string does mention "not in the same bridge".

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201081459.2104904-1-mmyangfl%40gmail.com
Technical Details
Message-ID: <179629654175.3146.5075008200642748094@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376510-linux-kernel-netdev=dewy.ru
References: <20261201081459.2104904-4-mmyangfl@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376510-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 3/5] net: dsa: motorcomm: Reject isolated
 redirect targets
Date: Thu, 03 Dec 2026 11:15:41 +0000
Organization: Usenet Network
Message-ID: <179629654175.3146.5075008200642748094@kernel.org>
References: <20261201081459.2104904-4-mmyangfl@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2469897"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ijHMhRi73rdxKqMfZVN/Xc9eMdw= sha256:Ejt2LH0v8CFoIaY6BezvL2qFjfJ2EvweaMQRJFkdW48=
	sha1:W/HaXBxmPTO6ppIPhHJctg2dKSY= sha256:gvT0JxTrWPsUulT0IiFdbagXdgX/aL/N6tB/W1CAq6s=
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 E25061178E9; Thu,  3 Dec 2026 14:15:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.74
X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.24, 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]
	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 Y5O_mBAZzmFx;
	Thu,  3 Dec 2026 14:15:56 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376510-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id A44C71178E6; Thu,  3 Dec 2026 14:15:48 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 8B1EE602DBE; Thu,  3 Dec 2026 11:15:47 +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=1796296543;
	b=QSy5wFwoE2KurhdvhCmC3J9t7lYa/YHR5nP2Jabx4fWCv72cBCsQNxZSfjA6QKJUmVNb
	 kqLoVAdO1hzXYT4ToVuli5ctpSiK0OnRyS8HrfTN2ydNhF126564CY+WOjmH07pYYxEt+
	 HPY8BBE2/v4uF/S2a7BA/ViV+9ibiGl4JAUZ3e/CbN2vIYuK/9YTEZmHhqu1ykw8i12NZ
	 DCqV+yonzqtDEzMdHrtlGjD9Mj5tRkYScx1TLHvBErVrtS+yiqqfdGQ7hQXgcrfSF98FE
	 7juMSoAPQBHQPgH7JTwZkPyO0bUlzdLQQtWXXqbQBvqpJ2n7qGgNBDXG2pn/KUNiNUA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796296543;
	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=FIAY7xXxS6G8sEZMenzUhhlO+bRdtpQFJkmvpkZGWf0=;
	b=v1+eepiR2HSTpX7zddxtLQeEUBiPe7+XPNXaYikllQFUnAkQfg3+c92hK7uHWHVIs9Kg
	 dwXejw77Fm0UEDdSjHEpXoGY7Z26+nlnp4kGRY44pYK2pDnlDhC182K9ZFeTI3dbEitUe
	 nYFADSD6S+OURNV9/BdzL7qBdY7602HO5e4+38f8bF8BS+/KE+JaEjHeEZRxUUoAfgIr6
	 fHpnizWec6qNCnHxjY4Hq1+6bgpJdMKMzy4ctUBLeJz6VabpwkfFTmsh8EvtifavEKGat
	 oB4f7APHHaK8bfkyb5qD7FbCs60K1MFKcaKpo48Cgu20k0+WQr/OB/QOQdtWixIOHdQ==
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=iVRdQPmY;
	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 D7F93606A322;
	Thu,  3 Dec 2026 11:15:43 +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=iVRdQPmY
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=1796296543;
	b=xhP2j4g17NoQv1n3u73Cvcfxx3ctbsTjuAZmmY57yvVXvGt8HWlJ6t/w9X5AMduQkDQn
	 0YTP1eA25LSZNG1f8c/dRHgYw0O518Ph9iN70ZSL/PxiYhs54HfVQ9oWvjn9r3ETu4mM/
	 Sg4EJy/RpA9s2K3qguIR4sKFqwiEwSWW9SXhNLcMKibvEmqcVsL6tWd1RWrM/83cSJDBU
	 hHz6UqV1OhEumOubCL3cWaPOBC5A1Vta6J9e2IRrIEDv3p9fE1/mppfLNDzQrBS7yxpqm
	 Tw6kbMzFTeaQoYJUf1SD/eKqJbkcMVLZqGjA0eybMCi6gM+C/v2RdzcQPHf4/dUmSig==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796296543;
	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=FIAY7xXxS6G8sEZMenzUhhlO+bRdtpQFJkmvpkZGWf0=;
	b=erwdaAa4Mc2sE00oa1mqmVRt/qVm9D5RJX6od1wykztZk+G2aiW4n/kel4k7Tdb5tepV
	 IY303PloUDG0RSFfSjQDK2tXBzVRQtvnSg0YR0CCRT5fQRHEPsrJn8fQlbOwd+sbrq8eB
	 KKXr9VbP775tiBXNB1ISCC9KeuX03xrjpKVgcNvFAnVb3mZflu3V35guJVfu8OiaEYsDo
	 ybNMOkfxdsZwMudm88wXT7NgGlXeDFBUtMGosJppsZuL0iF8/ySuVDbj66Wp/QVJbZqms
	 Lo6rcE3SMaqS1lIJrAn2+Tbwc1vDEe7LMVDIVwKWBsIcSws+nb+80XMgx6aGXkzTaZA==
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=iVRdQPmY;
	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 06DE6606A69A
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 11:15:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 366641F0092C;
	Thu,  3 Dec 2026 11:15:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796296542;
	bh=FIAY7xXxS6G8sEZMenzUhhlO+bRdtpQFJkmvpkZGWf0=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=iVRdQPmYaGJE/ZLBForKDdzIDGgejiIJLEpJQjpA4vC1CC1S0UHtK/Y3pKqG0XXHI
	 LF9lt6hGKJqE2cTTk5Dm9SPns+JiAtbZ/pFpdmtRu3KFfHdZOLEghpK7p3FkFfQGTY
	 CUlYncFrlZi9S4zI3xf7E1gfYa8+tsk62vuJP13tnrEYUEapmzjqaw1pSJCkxHs5Zy
	 SsXfIONjNm9Cw+e/PkkoW2YCEZiwHWh8ltxsISJ85YJgbaCb8k9sVTY8ARyCaYxOOO
	 ohwO1nzOtXR9ihtOYc1QCvDiyHbO3il6lL2BXc62z85ZA6pNJiXSij+Av2G96VybBg
	 9Mv/+R03t5PaA==
X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com
X-In-Reply-To: <20261201081459.2104904-4-mmyangfl@gmail.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