alx: acquire mutex for alx_reinit in alx_change_mtu
Subsystems (3)
PATCH v2 1/1 alx: acquire mutex for alx_reinit in alx_change_mtu
alx_reinit has a lockdep assertion that the alx->mtx mutex must be held. alx_reinit is called from two places: alx_reset and alx_change_mtu. alx_reset does acquire alx->mtx before calling alx_reinit. alx_change_mtu does not acquire this mutex, nor do its callers or any path towards alx_change_mtu.
Acquire the mutex in alx_change_mtu.
The issue was introduced when the fine-grained locking was introduced to the code to replace the RTNL. The same commit also introduced the lockdep assertion.
---
Changes in v2:
- Added Fixes tag and explainer
drivers/net/ethernet/atheros/alx/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/atheros/alx/main.c +4 -1
@@ -1181,8 +1181,11 @@ static int alx_change_mtu(struct net_device *netdev, int mtu) alx->hw.mtu = mtu; alx->rxbuf_size =max (max_frame,ALX_DEF_RXBUF_SIZE );netdev_update_features (netdev); -if (netif_running (netdev)) +if (netif_running (netdev)) { +mutex_lock (&alx->mtx);alx_reinit (alx); +mutex_unlock (&alx->mtx); + }return 0 ; }
Signature · 1 line
2.35.1
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 11 Mar 2022 00:27:08 +0100 you wrote:
alx_reinithas a lockdep assertion that thealx->mtxmutex must be held.alx_reinitis called from two places:alx_resetandalx_change_mtu.alx_resetdoes acquirealx->mtxbefore callingalx_reinit.alx_change_mtudoes not acquire this mutex, nor do its callers or any path towardsalx_change_mtu.
Acquire the mutex inalx_change_mtu.[...]
Here is the summary with links:
- [v2] alx: acquire mutex for alx_reinit in alx_change_mtu
https://git.kernel.org/netdev/net/c/46b348fd2d81
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html