net: lan966x: Fix usage of lan966x->mac_lock when entry is removed
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Thu, 14 Jul 2022 19:40:38 +0000 (21:40 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Jul 2022 03:00:00 +0000 (20:00 -0700)
commit99343cfa4f7560abf933fff7ab3ea58a6905c917
tree18375374a10f5237e79fe26d7c8f1f1f29c254d5
parent43243bb3195b0dc27741679471e23baed1efe98e
net: lan966x: Fix usage of lan966x->mac_lock when entry is removed

To remove an entry to the MAC table, it is required first to setup the
entry and then issue a command for the MAC to forget the entry.
So if it happens for two threads to remove simultaneously an entry
in MAC table then it would be a race condition.
Fix this by using lan966x->mac_lock to protect the HW access.

Fixes: e18aba8941b40 ("net: lan966x: add mactable support")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c