• Vladimir Oltean's avatar
    net: dsa: sja1105: serialize sja1105_port_mcast_flood() with other FDB accesses · ea32690d
    Vladimir Oltean authored
    sja1105_fdb_add() runs from the dsa_owq, and sja1105_port_mcast_flood()
    runs from switchdev_deferred_process_work(). Prior to the blamed commit,
    they used to be indirectly serialized through the rtnl_lock(), which
    no longer holds true because dsa_owq dropped that.
    
    So, it is now possible that we traverse the static config BLK_IDX_L2_LOOKUP
    elements concurrently compared to when we change them, in
    sja1105_static_fdb_change(). That is not ideal, since it might result in
    data corruption.
    
    Introduce a mutex which serializes accesses to the hardware FDB and to
    the static config elements for the L2 Address Lookup table.
    
    I can't find a good reason to add locking around sja1105_fdb_dump().
    I'll add it later if needed.
    
    Fixes: 0faf890f ("net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ea32690d
sja1105_main.c 97 KB