From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Thu, 3 Dec 2026 11:15:42 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 366641F0092C; Thu, 3 Dec 2026 11:15:42 +0000 (UTC) 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== Subject: Re: [PATCH net-next v3 3/5] net: dsa: motorcomm: Reject isolated redirect targets 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 Date: Thu, 03 Dec 2026 11:15:41 +0000 Message-ID: <179629654175.3146.5075008200642748094@kernel.org> In-Reply-To: <20261201081459.2104904-4-mmyangfl@gmail.com> References: <20261201081459.2104904-4-mmyangfl@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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