]> git.itanic.dy.fi Git - linux-stable/commit
net: dsa: sja1105: block FDB accesses that are concurrent with a switch reset
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 8 Sep 2023 13:33:52 +0000 (16:33 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Sep 2023 07:32:30 +0000 (08:32 +0100)
commit86899e9e1e29e854b5f6dcc24ba4f75f792c89aa
tree384540272566daf3c11747801d9f7a0ed78697c5
parentea32690daf4fa525dc5a4d164bd00ed8c756e1c6
net: dsa: sja1105: block FDB accesses that are concurrent with a switch reset

Currently, when we add the first sja1105 port to a bridge with
vlan_filtering 1, then we sometimes see this output:

sja1105 spi2.2: port 4 failed to read back entry for be:79:b4:9e:9e:96 vid 3088: -ENOENT
sja1105 spi2.2: Reset switch and programmed static config. Reason: VLAN filtering
sja1105 spi2.2: port 0 failed to add be:79:b4:9e:9e:96 vid 0 to fdb: -2

It is because sja1105_fdb_add() runs from the dsa_owq which is no longer
serialized with switch resets since it dropped the rtnl_lock() in the
blamed commit.

Either performing the FDB accesses before the reset, or after the reset,
is equally fine, because sja1105_static_fdb_change() backs up those
changes in the static config, but FDB access during reset isn't ok.

Make sja1105_static_config_reload() take the fdb_lock to fix that.

Fixes: 0faf890fc519 ("net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_main.c