]> git.baikalelectronics.ru Git - kernel.git/commit
net: lan966x: Fix taking rtnl_lock while holding spin_lock
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Thu, 14 Jul 2022 19:40:36 +0000 (21:40 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 19 Jul 2022 02:59:59 +0000 (19:59 -0700)
commit5dfbd149e4f30b963a27307186bb30ba58d6e23f
tree0c52356d2aec45c238fbe49c9ea03e5d4eb915e8
parent4bd5f9cc86f8f779416bb98ece1fb71d1b1f0102
net: lan966x: Fix taking rtnl_lock while holding spin_lock

When the HW deletes an entry in MAC table then it generates an
interrupt. The SW will go through it's own list of MAC entries and if it
is not found then it would notify the listeners about this. The problem
is that when the SW will go through it's own list it would take a spin
lock(lan966x->mac_lock) and when it notifies that the entry is deleted.
But to notify the listeners it taking the rtnl_lock which is illegal.

This is fixed by instead of notifying right away that the entry is
deleted, move the entry on a temp list and once, it checks all the
entries then just notify that the entries from temp list are deleted.

Fixes: ab3e5f5e79c6 ("net: lan966x: add support for interrupts from analyzer")
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