From: netdev-bot+sashiko@kernel.org
To: joseph@telaak.dev
Cc: florian.fainelli@broadcom.com, jonas.gorski@gmail.com,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: dsa: b53: mirror BPDUs to CPU port 5 when port 8 is not a CPU port
Date: Sun, 15 Nov 2026 06:44:24 +0000 [thread overview]
Message-ID: <179472506475.2199510.697226978948266850@kernel.org> (raw)
In-Reply-To: <20261111-b53-bpdu-mirror-v1-1-f9f32e9d25db@telaak.dev>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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 condition in b53_brcm_hdr_setup() calls
`!dsa_is_cpu_port(ds, B53_CPU_PORT)` (port 8) without checking that…
- [Low] The commit fixes a user-visible bug but has no Fixes: tag.
--
net: dsa: b53: mirror BPDUs to CPU port 5 when port 8 is not a CPU port
On BCM531x5 switches where port 5 is the CPU port and port 8 is not,
this patch uses the ingress mirror to copy frames sent to the bridge
group address from the user ports to port 5. It also refuses tc
mirroring on those boards, because the switch has only one mirror.
> Signed-off-by: Joseph Telaak <joseph@telaak.dev>
[Severity: Low]
Should this commit carry a Fixes: tag?
The notes below the --- line name 8fab459e69ab ("net: dsa: b53: Enable
Broadcom tags for 531x5/539x families"), but those notes are dropped
when the patch is applied.
That commit added the dual-IMP selection for port 5 in
b53_brcm_hdr_setup():
else if (port == 5)
hdr_ctl |= GC_FRM_MGMT_PORT_M;
Without the tag, nothing in the applied commit records which kernels
lose BPDUs on these boards.
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index a2a5754c413c6..6b33775c75985 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -797,6 +797,24 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
> hdr_ctl |= GC_FRM_MGMT_PORT_M;
> b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
>
> + /* With port 5 as the CPU port, a BCM531x5 runs in dual-IMP mode and
> + * traps BPDUs from LAN ports to port 8. When port 8 is not a CPU
> + * port, mirror them to port 5 instead. This takes the switch's only
> + * mirror, so tc mirroring is refused.
> + */
> + if (tag_en && port == 5 && is531x5(dev) &&
> + !dsa_is_cpu_port(ds, B53_CPU_PORT)) {
[Severity: High]
Can dsa_is_cpu_port(ds, B53_CPU_PORT) dereference a NULL pointer when
port 8 has no dsa_port?
DSA creates dsa_port objects only for indices below ds->num_ports
(dsa_switch_touch_ports()). b53_switch_init() derives that count from
enabled_ports:
dev->num_ports = fls(dev->enabled_ports);
dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);
When platform data is supplied (for example, b53_spi_probe() takes it
from spi->dev.platform_data), b53_switch_register() replaces the chip
table mask:
dev->enabled_ports = dev->pdata->enabled_ports;
Take a BCM531x5 described this way, using port 5 as the CPU port and
with BIT(8) cleared in enabled_ports (for example 0x3f). That leaves
ds->num_ports at 6, and the call chain becomes:
b53_setup()
b53_enable_cpu_port(dev, 5)
b53_brcm_hdr_setup(ds, 5)
dsa_is_cpu_port(ds, 8)
dsa_to_port(ds, 8) <- no index 8 on dst->ports, returns NULL
->type <- NULL dereference
dsa_to_port() returns NULL when no port matches, and dsa_is_cpu_port()
uses the result without checking it. Before this patch, b53 did not look
up the dsa_port for B53_CPU_PORT.
Boards probed from DT get the chip table mask, which includes port 8,
so only boards using b53_platform_data can hit this.
Could a missing port 8 count as not a CPU port, so the BPDU mirror is
still installed? Something like:
(B53_CPU_PORT >= ds->num_ports || !dsa_is_cpu_port(ds, B53_CPU_PORT))
> + b53_write48(dev, B53_MGMT_PAGE, B53_IG_MIR_MAC,
> + ether_addr_to_u64(eth_stp_addr));
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261111-b53-bpdu-mirror-v1-1-f9f32e9d25db%40telaak.dev
prev parent reply other threads:[~2026-11-15 6:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 6:30 Joseph Telaak
2026-11-11 10:11 ` Jonas Gorski
2026-11-11 17:22 ` Florian Fainelli
2026-11-11 19:02 ` Jonas Gorski
2026-11-11 23:17 ` Joseph Telaak
2026-11-11 23:15 ` Joseph Telaak
2026-11-15 6:44 ` netdev-bot+sashiko [this message]
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=179472506475.2199510.697226978948266850@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=jonas.gorski@gmail.com \
--cc=joseph@telaak.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®