]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lan743x: fix "BUG: invalid wait context" when setting rx mode
authorSven Van Asbroeck <thesven73@gmail.com>
Mon, 9 Nov 2020 20:38:28 +0000 (15:38 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:18:47 +0000 (19:18 +0100)
commit2b07f571617bc6ed2560c26b534c372150197da2
treebb2027f8b617ab24903fa8f6f6cc7be2fc0ba6ff
parent964e25377fab8e9071c07d8cdf1c9a4fb079285e
lan743x: fix "BUG: invalid wait context" when setting rx mode

[ Upstream commit 2b52a4b65bc8f14520fe6e996ea7fb3f7e400761 ]

In the net core, the struct net_device_ops -> ndo_set_rx_mode()
callback is called with the dev->addr_list_lock spinlock held.

However, this driver's ndo_set_rx_mode callback eventually calls
lan743x_dp_write(), which acquires a mutex. Mutex acquisition
may sleep, and this is not allowed when holding a spinlock.

Fix by removing the dp_lock mutex entirely. Its purpose is to
prevent concurrent accesses to the data port. No concurrent
accesses are possible, because the dev->addr_list_lock
spinlock in the core only lets through one thread at a time.

Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
Link: https://lore.kernel.org/r/20201109203828.5115-1-TheSven73@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/microchip/lan743x_main.c
drivers/net/ethernet/microchip/lan743x_main.h