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=1796510672; b=mUF7Ubjy1t+Fdb1TpNidogomIbQ4BYGigZrdlRl+Z1Y4JMuum9SE2NhjtNFhoi/WOBG4 OS6iz9GLHIcboQVm1S5xVUnSReRgj+ecGJPyWDOzvYyNQrazrJMAO8ws6/zc6e6si36qc nak09UVLwhaLK7gR6c2piOIIMfS/no4GzCFYHRm8kWeBNVJTRPYabTpGZuVkrLtMTykCb wGqSIBslA7jBZ+s9n19jpO3BIMp4LJeYELdpJHShlFaXQzjyw2tBFnoK7dMmf6e4C7CBt zsWSluQ5AuMOLFqirA9SxNOyLhBPpQfW+I8JfFHEi4rKH9wVjPAJMLXzsRf2uRp0YrQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796510672; 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=2XRM77uyGCO5P8f4r4mekmrIaEjTzn9soa3gAPii93k=; b=QZfvZmBcXdvawqfUC4UshgxF5X6BNfuZ3yunjBI4WWWMnSuoNwwEUb+qGhtQYc9ZRbVV g8yBvZfN4rfapvXzffur8fN0iWhe623rxqaqALifGPIr6CgQ0Iz4vBpGeHL+KWUSO0Iem hTiLT6O/zJiuL6eIZfKgJYHGDgWAfAwIu1YhXNeizsAZP2xQ08BFVxrO2GLsC/Qm5jiZT KjqujHONl2SZRLK/KV2CiFJ1OXTCQFlJuECXlpiP2FmSSXdagPkBCNq77KS9Ymv7wHmE7 Dr21V+Nd3jEFPk1rj6G48b7/z0MuOM6kKIcUifgx3Yse4hqqNepkj0xSPCxuLGGX8Bw== 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=oVE+H96d; 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 D02DB606A31F; Sat, 5 Dec 2026 22:44:32 +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=oVE+H96d Received: by smtp.kernel.org (Postfix) with ESMTPSA id 808061F00936; Sat, 5 Dec 2026 22:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796510672; bh=2XRM77uyGCO5P8f4r4mekmrIaEjTzn9soa3gAPii93k=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=oVE+H96djF3UmVRaWUw1R+KGeX/rQf5se5fIxqUfPRMJ4BrrHKWa6FGgUWD4wbmKd oDPkgf5bpTG7G4ME44zGis1b1Bjct8SJUIlJrxjIhUdyghq/DQ4WyYJaRtF9koTV7y zO6ocMU0lSDqYSWgVE2Z++mD9CGMq757me+euCytU2eMFFgiTarpfYZyXXYNuBoq0S u+zTFcCbAiYXLv2m7TEPZp28/rPg/29GvFaUZE4JUw5uuk2IcOGJuXPDH706LPwVy4 iEC/yKIOmgUmIpZNcCjYf+h5YF9sfUpLtvpnSHxnP+92GmYwt4X1ifSLnAhfdrqYVp zkx117UBTvNQQ== Subject: Re: [PATCH net v3 3/3] net: dsa: forward a marked frame only while its port is in a bridge From: netdev-bot+sashiko@kernel.org To: julius@bairaktaris.de Cc: andrew@lunn.ch, olteanv@gmail.com, netdev@vger.kernel.org, bridge@lists.linux.dev, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, razor@blackwall.org, idosch@nvidia.com, alvin.sipraga@analog.com, f.fainelli@gmail.com, tobias@waldekranz.com, linusw@kernel.org, paweldembicki@gmail.com Date: Sat, 05 Dec 2026 22:44:31 +0000 Message-ID: <179651067106.3148.13104164913848720920@kernel.org> In-Reply-To: <20261204222045.214014-4-julius@bairaktaris.de> References: <20261204222045.214014-4-julius@bairaktaris.de> 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] In an mv88e6xxx tree that mixes chips with and without a cross-chip Port VLAN Table (PVT), a bridge can still be granted TX… -- net: dsa: forward a marked frame only while its port is in a bridge This commit changes the tag_dsa, tag_sja1105 and tag_vsc73xx_8021q taggers to read dp->bridge only once. A new helper, dsa_xmit_fwd_offload(), lets them build a forward-in-bridge tag only when the frame is marked and the port is in a bridge with a non-zero number. This fixes a NULL dereference in br_vlan_enabled() and FORWARD tags for bridge 0 when a marked frame reaches a port that has left its bridge or was redirected by tc. Link: https://lore.kernel.org/all/20261121185821.1471559-1-julius@bairaktaris.de/ [1] > diff --git a/net/dsa/tag.h b/net/dsa/tag.h > index 0e1be1da4537e..fd543eb705c2c 100644 > --- a/net/dsa/tag.h > +++ b/net/dsa/tag.h > @@ -241,6 +241,20 @@ static inline void dsa_default_offload_fwd_mark(struct sk_buff *skb) > skb->offload_fwd_mark = !!READ_ONCE(dp->bridge); > } > > +/* Whether the switch is to forward @skb on behalf of @bridge, the bridge of > + * the user port as the tagger read it, once. The bridge marks a frame for TX > + * forwarding offload only on a port whose bridge has a number. A frame can > + * also carry a mark set before its port left the bridge, or one set on > + * reception and kept by a redirect; it is then forwarded in a bridge only if > + * the port is in one that has a number, and otherwise sent to the port the > + * stack chose. > + */ > +static inline bool dsa_xmit_fwd_offload(const struct sk_buff *skb, > + const struct dsa_bridge *bridge) > +{ > + return skb->offload_fwd_mark && bridge && bridge->num; > +} [Severity: Medium] Does mv88e6xxx actually follow the rule in this comment: "The bridge marks a frame for TX forwarding offload only on a port whose bridge has a number"? On any chip with a PVT, mv88e6xxx_port_bridge_join() grants TX forwarding offload without checking bridge.num: drivers/net/dsa/mv88e6xxx/chip.c:mv88e6xxx_port_bridge_join() { ... if (mv88e6xxx_has_pvt(chip)) { err = mv88e6xxx_map_virtual_bridge_to_pvt(ds, bridge.num); if (err) goto unlock; *tx_fwd_offload = true; } ... } A bridge first joined from a chip without a PVT gets number 0. mv88e6xxx_setup() never sets ds->max_num_bridges for that chip, so dsa_bridge_num_get() returns 0. Switches that join later reuse that dsa_bridge through dsa_tree_bridge_find(). A tree with only PVT chips can hit the same case when last_switch is 31. max_num_bridges is then MV88E6XXX_MAX_PVT_SWITCHES - last_switch - 1, which is 0. When a port on a PVT chip joins such a bridge, dsa_port_bridge_join() passes tx_fwd_offload = true to switchdev_bridge_port_offload(), and the bridge sets BR_TX_FWD_OFFLOAD_BIT on the port. On a flood, nbp_switchdev_frame_mark_tx_fwd_to_hwdom() sets the tree's hwdom bit in fwd_hwdoms. nbp_switchdev_allowed_egress() then skips every other port in the same DSA tree. The bridge sends one marked copy and expects the switch to flood it. With this patch, dsa_xmit_fwd_offload() returns false for bridge->num == 0, so dsa_xmit_ll() takes the FROM_CPU branch for that one copy: cmd = DSA_CMD_FROM_CPU; tag_dev = dp->ds->index; tag_port = dp->index; If so, only this one port receives broadcast, multicast and unknown unicast traffic from the host or from other bridge ports, such as ARP requests and IPv6 ND. Would the bridge's other ports in the tree stop getting these floods altogether? The commit message says such frames "now go to the one port the bridge chose", but it does not say that the other ports stop getting floods. The old behaviour was also wrong. A FORWARD tag with tag_dev = last_switch is treated by mv88e6xxx_port_vlan() as the physical switch last_switch. Could this be fixed in mv88e6xxx_port_bridge_join() instead? It could skip setting *tx_fwd_offload, and skip mapping the virtual bridge into the PVT, when bridge.num is 0. The bridge would then send one unmarked copy per port, and the FROM_CPU path in dsa_xmit_ll() would be correct. [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204222045.214014-1-julius%40bairaktaris.de