Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: zihengw03@163.com
Cc: idosch@nvidia.com, petrm@nvidia.com, andrew+netdev@lunn.ch,
	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 v2] mlxsw: spectrum_switchdev: fix wrong list member in flood rollback
Date: Thu, 03 Dec 2026 14:06:09 +0000	[thread overview]
Message-ID: <179630676913.3146.11195765689296855371@kernel.org> (raw)
In-Reply-To: <20261201140545.1572541-1-zihengw03@163.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · 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).

- [Medium] The v2 changelog says the Fixes: tag was dropped as "non-
  regression".
- [Low] The commit message for "mlxsw: spectrum_switchdev: fix wrong list
  member in flood rollback" explains the mechanics: rollback now…

--

mlxsw: spectrum_switchdev: fix wrong list member in flood rollback

This patch fixes the err_fid_flood_set rollback loop in
mlxsw_sp_bridge_vlans_flood_set(). The loop now iterates with the
bridge_vlan_node member instead of the list member, so it walks
bridge_vlan->port_vlan_list just like the forward loop.

> Use bridge_vlan_node so rollback computes the proper container address
> and walks the same list as the forward loop.

[Severity: Low]
Could the commit message also say what the old rollback did when
mlxsw_sp_fid_flood_set() failed?

In struct mlxsw_sp_port_vlan, list links the entry into
mlxsw_sp_port->vlans_list. bridge_vlan_node links it into
bridge_vlan->port_vlan_list:

struct mlxsw_sp_port_vlan {
	struct list_head list;
	struct mlxsw_sp_port *mlxsw_sp_port;
	struct mlxsw_sp_fid *fid;
	...
	struct list_head bridge_vlan_node;
};

So the old loop walked the failing port's vlans_list. It called
mlxsw_sp_fid_flood_set(..., !member) on the FIDs of unrelated VLANs on
that port and rewrote their hardware flood membership.

The check against &bridge_vlan->port_vlan_list could never match, so the
loop never stopped there. When the walk reached &mlxsw_sp_port->vlans_list,
it treated the list head as an entry. Since list is at offset 0, ->fid
pointed at mlxsw_sp_port->qdisc and ->mlxsw_sp_port pointed at
mlxsw_sp_port->default_vlan:

struct mlxsw_sp_port {
	...
	struct list_head vlans_list;
	struct mlxsw_sp_port_vlan *default_vlan;
	struct mlxsw_sp_qdisc_state *qdisc;
	...
};

mlxsw_sp_fid_flood_set() then follows fid->fid_family and
fid_family->flood_profile through that garbage pointer, which would likely
oops. If it doesn't oops, the walk goes round the circular list forever.

A bridge mcast_snooping toggle can reach this path:

mlxsw_sp_port_attr_set()->mlxsw_sp_port_mc_disabled_set()->
mlxsw_sp_bridge_ports_flood_table_set()->mlxsw_sp_bridge_vlans_flood_set()

It triggers when mlxsw_sp_fid_flood_set() -> mlxsw_sp_pgt_entry_port_add()
fails because an allocation or a register write fails.

Documentation/process/submitting-patches.rst asks for the user-visible
impact even when a problem was found by code review. Could the changelog
mention the possible oops or endless loop? Otherwise the fix may look like
a cosmetic error-path cleanup.

> v1 -> v2:
> - Retarget from net to net-next, drop non-regression Fixes tag, and add
>   Petr Machata's Reviewed-by.

[Severity: Medium]
Should this keep a Fixes: tag?

git blame shows that this commit added both
mlxsw_sp_bridge_vlans_flood_set() and the list member in its rollback
loop:

a6f43b1dad800d ("mlxsw: spectrum_switchdev: Simplify mlxsw_sp_port_mc_disabled_set()")

That commit is in v6.0 and later.

Documentation/process/maintainer-netdev.rst says the Fixes: tag is
required for fixes regardless of the tree. That applies whether or not the
bug is a regression.

Without the tag or a Cc: stable, stable kernels from v6.0 on have nothing
telling them they need this one-line fix. They would keep the rollback
path described above.

Something like:

Fixes: a6f43b1dad800d ("mlxsw: spectrum_switchdev: Simplify mlxsw_sp_port_mc_disabled_set()")

I couldn't see the v1 review discussion. If a maintainer asked for the tag
to be dropped there, please disregard this.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201140545.1572541-1-zihengw03%40163.com

      reply	other threads:[~2026-12-03 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 14:05 [PATCH net-next v2] mlxsw: spectrum_switchdev: fix wrong list member in flood rollback Ziheng Wei
2026-12-03 14:06 ` 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=179630676913.3146.11195765689296855371@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=zihengw03@163.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