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=1796468447; b=Dfe9zQJblPMdatrGWVUsXnt/7u3Eb5l6RBdE3/eFsIOjrO5nDgBQ4y1qpzOm3pvkfXJ1 8C5LbGVGaprdxUuBfotHqZVvaFwpk9tz1kdcBEz+uFh3PgMfKyBwkDzXc7RnYCgbl3clK g8fIi5f6vL2B5QJUKC2tX0cP4vDk/kkdMMM+/Zn+sbf8FSQGKCf9ufDShcDrCY9cBmQyF ZL14e/xZtZhWqTOAqBNjL9h07nhiLq7h2/yy1ZvpJFqTONAwcEiV31EkJVUNYJhV70bTE LmhUJo+XiXzLyKZcNK6oQkPyBpQs54TbyHjk3wmpct1DglWBXedr5BWZlX+JnP6tOZQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796468447; 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=RkbPkhVynH3qFUsNBq10Ts0AY26RpK2gbe9Mb5cPm70=; b=aX+UWS3CHqy5DdIQHXHO003gCdweY+AIngZ+J7ZCujaHh2KC6iKGpFG0LYvoEnx24GqN SwrkcyrKnSrzEqDzgTpO8WKOV3qgGvIWOT6odYhR+nc1RUwx1iZjQyCtxcrzPy+leHH9g W/jE5bN3kwS2kviujToq3KxZJG/ZcvjJZj3r1FMzZAsRr3m6E84DhttBNZ+j1AZAWMdKd GzZfL4nYPf2f3ty35w0M/NxiTXDdl7Dn2eWgs0AHoPd29TZ2aLG/wGrXwV7XcVWVkep7M +0PhkETUc8/KT3PBHXNe1Yo8lTPCysoq3PmHPb9h9niBF+rh5IWtcCVBZ9AIzV5A3nA== 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=AohjUOmI; 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 09B1D606A338 for ; Sat, 5 Dec 2026 11:00:46 +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=AohjUOmI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C6911F0092B; Sat, 5 Dec 2026 11:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796468446; bh=RkbPkhVynH3qFUsNBq10Ts0AY26RpK2gbe9Mb5cPm70=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=AohjUOmICY1cj+yBJnGLKPxTulq2NP9jcTOFWO6OwgVMtrz7jfs4h1kkzegymKOo6 M4gWRytzHd88gKV8hWSJ1wKqbPy7tj8IrO/5vz5UeumuUM6KEb/+no7bXBMdxbbRPW JcRzJ2GYcBbttOeqY2nMGlOkLnJNQqd0uLH7rMyrpWovUqryg2mKb+KoQ9K11oAAKY 8pr+In4vpT+3q68plZEoD00hhQmb2qxispTDN+wtgtdvyuqnMUSFpbUN+ztbxML6ts Id/dRokQfqRlFlv1pALLCounhUPetzpvE2UODVpAjPct+ogs7WN29A4gICmOa8rh3t 3od45sowGpdgQ== Subject: Re: [PATCH net-next v4 5/6] net: dsa: motorcomm: Reject bridge flags that break redirect rules 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, 05 Dec 2026 11:00:45 +0000 Message-ID: <179646844578.3146.6159172839639383786@kernel.org> In-Reply-To: <20261204101300.3680838-6-mmyangfl@gmail.com> References: <20261204101300.3680838-6-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 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 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] yt921x_dsa_port_pre_bridge_flags() (drivers/net/dsa/motorcomm/chip.c) does not veto BR_ISOLATED when the… -- net: dsa: motorcomm: Reject bridge flags that break redirect rules This commit adds per-port acl_dst_cnts bookkeeping in yt921x_acl_add() and yt921x_acl_del() for redirect rules that are not sw_assisted. It then uses those counters in yt921x_dsa_port_pre_bridge_flags() to reject turning off hairpin mode, or turning on BR_ISOLATED, when the change would block such a rule. > diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c > index a71a8dd5dc63c..323c1705f613c 100644 > --- a/drivers/net/dsa/motorcomm/chip.c > +++ b/drivers/net/dsa/motorcomm/chip.c > @@ -1525,9 +1525,52 @@ yt921x_dsa_port_pre_bridge_flags(struct dsa_switch *ds, int port, [ ... ] > + if ((flags.mask & BR_ISOLATED) && (flags.val & BR_ISOLATED)) { > + struct dsa_port *other_dp; > + > + dsa_switch_for_each_user_port(other_dp, ds) { > + struct net_device *other_brport; > + int i = other_dp->index; > + > + if (i == port || !(ports_mask & BIT(i))) > + continue; > + if (!pp->acl_dst_cnts[i] && > + !priv->ports[i].acl_dst_cnts[port]) > + continue; > + > + other_brport = dsa_port_to_bridge_port(other_dp); > + if (!br_port_flag_is_set(other_brport, BR_ISOLATED)) > + continue; [Severity: Medium] Can this check be bypassed when both ends of a skip_sw redirect rule are members of the same offloaded LAG? The port being changed gets its new isolation state from flags.val. The peer's state is read back from the bridge. For LAG members, dsa_port_to_bridge_port() returns the shared LAG netdev: include/net/dsa.h:dsa_port_to_bridge_port() { ... if (dp->lag) return dp->lag->dev; ... } The bridge sends PRE_BRIDGE_FLAGS before it writes the new value into p->flags. This happens on both the netlink path and the sysfs path: net/bridge/br_netlink.c:br_setport() { ... err = br_switchdev_set_port_flag(p, flags, changed_mask, extack); ... } while (!try_cmpxchg(&p->flags, &old_flags, flags)); ... } net/bridge/br_sysfs_if.c:store_flag() { ... err = br_switchdev_set_port_flag(p, flags, BIT(bitnr), &extack); ... assign_bit(bitnr, &p->flags, v); ... } So when the LAG bridge port itself is being isolated, each member sees its LAG peer as not yet isolated and hits the continue above. Here is an example. Ports P and Q are in one offloaded LAG, bond0, and bond0 is a bridge port: skip_sw flower redirect rule from P to Q -> P's acl_dst_cnts[Q] is incremented bridge link set dev bond0 isolated on -> pre_bridge_flags(P) and pre_bridge_flags(Q) both return 0 -> .port_bridge_flags -> yt921x_isolation_refresh() -> yt921x_isolation_calc_bridge() When yt921x_isolation_calc_bridge() runs, bond0 now reads as isolated: if (br_port_flag_is_set(brport, BR_ISOLATED)) isolated_mask |= BIT(port); That gives isolated_mask = BIT(P) | BIT(Q). Q's bit then lands in P's isolation mask, and the hardware drops the P->Q redirect even though the rule was accepted as skip_sw. Isn't this the case the commit message says should be rejected? The later patch in the series ("net: dsa: motorcomm: Recompute redirect rules on bridge changes") does not change yt921x_dsa_port_pre_bridge_flags(), so this still seems to apply at the end of the series. The new warning that patch adds in yt921x_bridge_flags() would not reach the user here either, because the deferred switchdev attr path passes a NULL extack. > + > + NL_SET_ERR_MSG_MOD(extack, > + "Cannot isolate port while there are redirect rules"); > + return -EINVAL; > + } > + } > + > return 0; > } [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204101300.3680838-1-mmyangfl%40gmail.com