From: netdev-bot+sashiko@kernel.org
To: mmyangfl@gmail.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch, olteanv@gmail.com,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com
Subject: Re: [PATCH net-next v3 3/5] net: dsa: motorcomm: Reject isolated redirect targets
Date: Thu, 03 Dec 2026 11:15:41 +0000 [thread overview]
Message-ID: <179629654175.3146.5075008200642748094@kernel.org> (raw)
In-Reply-To: <20261201081459.2104904-4-mmyangfl@gmail.com>
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
next prev parent reply other threads:[~2026-12-03 11:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:14 [PATCH net-next v3 0/5] net: dsa: motorcomm: Reject isolated redirect targets David Yang
2026-12-01 8:14 ` [PATCH net-next v3 1/5] net: dsa: motorcomm: Remove local cpu_ports_mask David Yang
2026-12-01 8:14 ` [PATCH net-next v3 2/5] net: dsa: motorcomm: Cache port isolation masks David Yang
2026-12-03 11:15 ` netdev-bot+sashiko
2026-12-01 8:14 ` [PATCH net-next v3 3/5] net: dsa: motorcomm: Reject isolated redirect targets David Yang
2026-12-03 11:15 ` netdev-bot+sashiko [this message]
2026-12-01 8:14 ` [PATCH net-next v3 4/5] net: dsa: motorcomm: Reject bridge flags that break redirect rules David Yang
2026-12-03 11:15 ` netdev-bot+sashiko
2026-12-01 8:14 ` [PATCH net-next v3 5/5] net: dsa: motorcomm: Recompute redirect rules on bridge changes David Yang
2026-12-03 11:15 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179629654175.3146.5075008200642748094@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox