Skip to content

Commit 86899e9

Browse files
vladimirolteandavem330
authored andcommitted
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: 0faf890 ("net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work") Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ea32690 commit 86899e9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,6 +2297,7 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
22972297
int rc, i;
22982298
s64 now;
22992299

2300+
mutex_lock(&priv->fdb_lock);
23002301
mutex_lock(&priv->mgmt_lock);
23012302

23022303
mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
@@ -2409,6 +2410,7 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
24092410
goto out;
24102411
out:
24112412
mutex_unlock(&priv->mgmt_lock);
2413+
mutex_unlock(&priv->fdb_lock);
24122414

24132415
return rc;
24142416
}

0 commit comments

Comments
 (0)