]> git.baikalelectronics.ru Git - kernel.git/commit
net: lan966x: Fix usage of lan966x->mac_lock when entry is added
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Thu, 14 Jul 2022 19:40:37 +0000 (21:40 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Jul 2022 02:59:59 +0000 (19:59 -0700)
commitcdc5591641c8ffbb3b5d3085975fd0e05ea140ce
tree054d03018a15cee763c0689372fdd6ae008e78c3
parent5dfbd149e4f30b963a27307186bb30ba58d6e23f
net: lan966x: Fix usage of lan966x->mac_lock when entry is added

To add an entry to the MAC table, it is required first to setup the
entry and then issue a command for the MAC to learn the entry.
So if it happens for two threads to add 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: 8f0b36c171e82 ("net: lan966x: Add function lan966x_mac_ip_learn()")
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