Article View: linux.kernel.netdev
Article #23902Re: [PATCH net] net: dsa: motorcomm: Reject isolated redirect targets
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 14:28
Date: Sat, 28 Nov 2026 14:28
170 lines
14040 bytes
14040 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 1
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).
- [High] The new isolation, hairpin and same-bridge check runs only when
a flower rule is installed, in yt921x_acl_rule_ext_parse_flow_action()…
- [Medium] The new check refuses a redirect from a port to itself when
that port is both hairpin and isolated, but the driver's own hardware…
- [Low] In yt921x_acl_rule_ext_parse_flow_action()
(drivers/net/dsa/motorcomm/tc.c:1087-1088), every case where…
--
net: dsa: motorcomm: Reject isolated redirect targets
This patch makes yt921x_acl_rule_ext_parse_flow_action() refuse to
offload a mirred redirect in three cases: the target is not in the same
bridge, the target is the source port without hairpin, or both ports are
isolated. Such rules are rejected under skip_sw. Otherwise they fall back
to a software-assisted TRAP.
> diff --git a/drivers/net/dsa/motorcomm/tc.c b/drivers/net/dsa/motorcomm/tc.c
> index e3f057ed580f5..5713ae84ece7c 100644
> --- a/drivers/net/dsa/motorcomm/tc.c
> +++ b/drivers/net/dsa/motorcomm/tc.c
[ ... ]
> @@ -1072,6 +1075,27 @@ yt921x_acl_rule_ext_parse_flow_action(struct yt921x_acl_rule_ext *ruleext,
> goto fallback;
> }
>
> + /* Port isolation takes after REDIR judgment, but
> + * software may deliver such frames.
> + *
> + * Bridge membership changes may break existing REDIR
> + * rules, but we cannot do anything here: driver can
> + * neither reject such changes (port_bridge_leave() is
> + * void), nor tell tc which one is invalidated.
> + */
[Severity: High]
This check only runs when the flower rule is installed. What happens to a
REDIR rule that is already in hardware when the isolation flags change
later?
For example, with swp0 and swp1 in the same bridge and not isolated:
tc filter add dev swp0 ingress flower ... \
action mirred egress redirect dev swp1
bridge link set dev swp0 isolated on
bridge link set dev swp1 isolated on
The tc rule passes the new check, and a REDIR to port 1 is programmed.
The bridge link changes then go through:
yt921x_dsa_port_bridge_flags()
yt921x_bridge_flags()
pp->isolated = flags.val & BR_ISOLATED;
yt921x_bridge()
if (pp->isolated)
ctrl |= isolated_mask;
yt921x_reg_write(priv, YT921X_PORTn_ISOLATION(port), ctrl);
None of this touches the ACL table. Wouldn't hardware port isolation then
block the installed REDIR, so matching frames are silently dropped?
Software mirred would have delivered them. That looks like the same case
the commit message describes.
The same seems to happen when BR_HAIRPIN_MODE is cleared on a port that
has a self-redirect rule. It also happens when the target leaves the
bridge, because yt921x_userport_standalone() writes:
ctrl = ~priv->cpu_ports_mask;
res = yt921x_reg_write(priv, YT921X_PORTn_ISOLATION(port), ctrl);
The comment only mentions bridge membership changes. Is it right that
nothing can be done about flag changes? BR_ISOLATED and BR_HAIRPIN_MODE
changes go through yt921x_dsa_port_pre_bridge_flags(), which returns int
and gets an extack:
if (flags.mask & ~(BR_HAIRPIN_MODE | BR_LEARNING | BR_FLOOD |
BR_MCAST_FLOOD | BR_ISOLATED))
return -EINVAL;
return 0;
Could that hook refuse flag changes that would invalidate live REDIR
rules?
For rules without skip_sw, the driver already records
ruleext->r.sw_assisted. It also has a downgrade-to-TRAP path in
yt921x_acl_add():
if (use_trap) {
aclrule->action[2] &= ~YT921X_ACL_ACTc_FWD_REDIR_DPORTS_M &
~YT921X_ACL_ACTc_FWD_M;
Could the affected rules be rewritten to TRAP the same way when bridge
membership or flags change?
As written, the protection only seems to hold if the bridge and isolation
setup is done before the tc rules are added. The commit message doesn't
mention this.
> + dp = dsa_to_port(&priv->ds, port);
> + if (!dsa_port_bridge_same(dp, to_dp)) {
> + reason = "Redirect to another bridge";
> + goto fallback;
> + }
[Severity: Low]
This isn't a bug, but dsa_port_bridge_same() also returns false when
either port is standalone:
/* Standalone ports are not in the same bridge with one another */
return (!br_a || !br_b) ? false : (br_a == br_b);
With skip_sw, a redirect between two standalone ports, or from a
standalone port to itself, reports "Redirect to another bridge" even
though no bridge is involved.
Rejecting the rule is still correct, since yt921x_userport_standalone()
blocks all non-CPU ports. Could the reason string also cover the
standalone case?
> +
> + to_pp = &priv->ports[to_dp->index];
> + if ((to_dp->index == port && !pp->hairpin) ||
> + (pp->isolated && to_pp->isolated)) {
> + reason = "Redirect target is isolated";
> + goto fallback;
> + }
[Severity: Medium]
Does this reject a self-redirect on a port that is both hairpin and
isolated, even though the hardware allows it?
When to_dp->index == port, to_pp == pp. The second clause is then true
whenever the port is isolated, even if pp->hairpin is set.
In yt921x_bridge(), the hairpin branch runs after isolated_mask is ORed
in, so the self bit ends up cleared:
if (pp->isolated)
ctrl |= isolated_mask;
/* to itself when non-hairpin */
if (!pp->hairpin)
ctrl |= BIT(port);
else
ctrl &= ~BIT(port);
With skip_sw, this returns -EOPNOTSUPP for a rule the hardware can run.
Without skip_sw, the rule becomes YT921X_ACL_ACTc_FWD_TRAP, and every
matching frame goes through the CPU. Before this patch the rule was
offloaded.
Should the isolated clause leave out the self case, for example:
(to_dp->index != port && pp->isolated && to_pp->isolated)
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127142732.1337041-1-mmyangfl%40gmail.com
Technical Details
Message-ID:
<179587613426.3135.1461093836269576159@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373166-linux-kernel-netdev=dewy.ruReferences:
<20261127142732.1337041-1-mmyangfl@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373166-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: dsa: motorcomm: Reject isolated redirect targets Date: Sat, 28 Nov 2026 14:28:54 +0000 Organization: Usenet Network Message-ID: <179587613426.3135.1461093836269576159@kernel.org> References: <20261127142732.1337041-1-mmyangfl@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="966002"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:C1P9oTD0OY30G9HI1MuxsFSutuU= sha256:E56e9rAdrG73LgsDWz7H3t+9JT0wHKonuGGcxqnKmbc= sha1:JC+v3p+WnuKeosXrZ+ERigCe65Y= sha256:lqngXJUFw0Lzg39Dh5JESJwcjaeMRqh9oZ2tV32KKd8= 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 CAE47125F7D; Sat, 28 Nov 2026 17:29:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[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 anWUGxbVLWIV; Sat, 28 Nov 2026 17:29:09 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-373166-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 28DDE125F77; Sat, 28 Nov 2026 17:28:58 +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 ADFA4601BF9; Sat, 28 Nov 2026 14:28: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=1795876137; b=cra492AXqxSJswqXbJcL4V3wIpN8Psf4jIj787aPCsUJt2usVmkWiLX7nrA+vQsMoteO J+ngLKze48jytNITnqxwIU3qK/NnXix+KSSqQiVJP/L8HQ+MpeBU465GDWdAhVRTHZvAw XVWnPjVWLyQzzYoswXz7aGyOsdW5J190YmHDthAndve6dOjB0ilArNrDuFP/rDTywC2kD wW/xHUEkD4dq07P0kjUITkKHR5ejff/nz0KkQ+VSmq8W0bp87QrN0Pt7V9D5PcOzSLSQ/ QCtFQZZZQQCc+V3Q+DDZnTCpo7vLP8swoRd4lxjcRTkyyLbqAwfOVUv5gT78nwKKvHQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795876137; 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=vvO9SZfU7LrIpiv5hjwc3qv2UGa/W/F2qFlVuQDvzRM=; b=N8rf7uFnCgFHrJj0d1OVSTUjOzAGjD3DRiOy8ewvR9PlD7fII6IfRZhIhynkcFbpY5o8 L0MtMyhfdKQcAYkumeSCXB3vc7aBUqsraNBz9p6qhSsQZ03EpIXPZDytCeW+vap2scfcO Oc2eNEvnWNeLHRkIY64qMGlk2mZFQy5y+0I9mDh5LGwdCWW/l7l6sYEsX/nHCWmhpQAqY SPsSXmLxUmIoSZV53vZqHgUZQzckIUjdICSOzEwjQeRV90kzYT6ZjJpVmcWNgKi6dunkH mLm1/haOmu3zSFbX8tFU1dVwQ0GKWZICqF9F2voRT2kvuZYjL4RVZqi2jRbutriAZ8Q== 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=Hx0FF13d; 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 DCA60606A326; Sat, 28 Nov 2026 14:28:56 +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=Hx0FF13d 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=1795876136; b=yKs3ZvyRkz3u9I6txXvTaQ3bZMLBbA1jVFAdqGYwHmj+KrlEnSYfbxviIo60LPn4dr+E DxfF05FIXy+TaGlkDnVTLh4G6W0SjgFi6KnC6WiVKYY5EnBYhgkGohgESu0nEzQ/A3JW6 TJrlnpIAgM7xbnIp4Mhb+boJdk2QImIcITewO/sZmTbSnRQvnOM9sp4943ukGWqOp1Y9O 2X0KfM8Jthm2i781FTER0Q+49JRlkFEtpDmj7IHBom1k+CGjkybPeS/HvnviYTpE38poZ MsTrh4jJJoKGhnHgTp0smqgpjTXt3jPTL/8Ku5is5I8g7bz98vehIWCrB2/Ux6h/IRg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795876136; 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=vvO9SZfU7LrIpiv5hjwc3qv2UGa/W/F2qFlVuQDvzRM=; b=5Gjx3FYZakcTpJi5pCUuHvLRboZOXMD66zibhiNTFrJbcdsnwsykrPoPaMfiIVKepb9i XZUjPhBZDGyNxC2e52p2RJkJmlsKRhvoWbTL/2jk74XbSz5cxDedwg0LMzpepu4dwKNLE MZlxbsc5wUPek+W0BU6ZWwsfQaBvRUSApWnbE9wbhQH9YnWyBsIhDLh7ajeAn1sLhBLmV cDZgr4ZLuoFVNFWs19GBjc9jrmLlefG+2/HnmROiSg8MX29/s0b0rDbFKnrSrqUTutdYb iOx45ReMzclrn4BQyw1hGbRwiqALGv0C2AnW+dgDkJglsMl78mUx4fiPsw1biGvhOSw== 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=Hx0FF13d; 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 082C8606A31F for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 14:28:55 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C004E1F00897; Sat, 28 Nov 2026 14:28:54 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795876135; bh=vvO9SZfU7LrIpiv5hjwc3qv2UGa/W/F2qFlVuQDvzRM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Hx0FF13dHP5v5O8inHssQLCBqXrvgFjouxfO3+PAtMRU5DeGmBCOLXbFmSijijVYv X+Ja/Mp1+kalLZna3VF2JSYttxPhONmTceWMx7Xecm+z8VdABdt15OVdY0HFiLAcw6 TSN14ngcTuCmzKLTb1dRLpv3f/y7Sc4yoNCDTNkC4DEXNEiLfzKdBNSgKGXDeOM6/U LmitgyB5OGWY4yxPbmJuoKFuvE6BK7JUqi3J5WMV60y84sYvdwElRLK94XtdQOhT4t DnXiiFNyz7fyhwKX+bdeyJ0cPjByZqFKb5k8iLRUs/YCZKgTp17k14cim3QphAfOeG CdvCGvJbvhB3w== 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: <20261127142732.1337041-1-mmyangfl@gmail.com> X-sashiko-severity: High 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