]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: dsa: move port lists initialization to dsa_port_touch
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 8 Mar 2022 09:15:11 +0000 (11:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Mar 2022 11:12:09 +0000 (11:12 +0000)
commitfe95784fb14e4d56072b7be7325ef859efa38135
treeabc27edb1719d8a69ab57aa5c2000197dd620998
parent0832cd9f1f023226527e95002d537123061ddac4
net: dsa: move port lists initialization to dsa_port_touch

&cpu_db->fdbs and &cpu_db->mdbs may be uninitialized lists during some
call paths of felix_set_tag_protocol().

There was an attempt to avoid calling dsa_port_walk_fdbs() during setup
by using a "bool change" in the felix driver, but this doesn't work when
the tagging protocol is defined in the device tree, and a change is
triggered by DSA at pseudo-runtime:

dsa_tree_setup_switches
-> dsa_switch_setup
   -> dsa_switch_setup_tag_protocol
      -> ds->ops->change_tag_protocol
dsa_tree_setup_ports
-> dsa_port_setup
   -> &dp->fdbs and &db->mdbs only get initialized here

So it seems like the only way to fix this is to move the initialization
of these lists earlier.

dsa_port_touch() is called from dsa_switch_touch_ports() which is called
from dsa_switch_parse_of(), and this runs completely before
dsa_tree_setup(). Similarly, dsa_switch_release_ports() runs after
dsa_tree_teardown().

Fixes: f9cef64fa23f ("net: dsa: felix: migrate host FDB and MDB entries when changing tag proto")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c