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=1795876136; b=yKs3ZvyRkz3u9I6txXvTaQ3bZMLBbA1jVFAdqGYwHmj+KrlEnSYfbxviIo60LPn4dr+E DxfF05FIXy+TaGlkDnVTLh4G6W0SjgFi6KnC6WiVKYY5EnBYhgkGohgESu0nEzQ/A3JW6 TJrlnpIAgM7xbnIp4Mhb+boJdk2QImIcITewO/sZmTbSnRQvnOM9sp4943ukGWqOp1Y9O 2X0KfM8Jthm2i781FTER0Q+49JRlkFEtpDmj7IHBom1k+CGjkybPeS/HvnviYTpE38poZ MsTrh4jJJoKGhnHgTp0smqgpjTXt3jPTL/8Ku5is5I8g7bz98vehIWCrB2/Ux6h/IRg== 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== 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 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 ; Sat, 28 Nov 2026 14:28:55 +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=Hx0FF13d Received: by smtp.kernel.org (Postfix) with ESMTPSA id C004E1F00897; Sat, 28 Nov 2026 14:28:54 +0000 (UTC) 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== Subject: Re: [PATCH net] 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: Sat, 28 Nov 2026 14:28:54 +0000 Message-ID: <179587613426.3135.1461093836269576159@kernel.org> In-Reply-To: <20261127142732.1337041-1-mmyangfl@gmail.com> References: <20261127142732.1337041-1-mmyangfl@gmail.com> X-sashiko-severity: High 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: 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