[PATCH v2 net 1/1] net: stmmac: Use rtnl_lock/unlock on netif_set_real_num_rx_queues() call

Subsystems: networking drivers, stmmac ethernet driver, the rest

STALE2083d LANDED: 2 (0M)

2 review trailers; landed in mainline as 8e5debed3901 on 2020-11-17.

2 messages, 2 authors, 2020-11-17 · open the first message on its own page

[PATCH v2 net 1/1] net: stmmac: Use rtnl_lock/unlock on netif_set_real_num_rx_queues() call

From: Wong Vee Khee <hidden>
Date: 2020-11-15 07:39:32

Fix an issue where dump stack is printed on suspend resume flow due to
netif_set_real_num_rx_queues() is not called with rtnl_lock held().

Fixes: 686cff3d7022 ("net: stmmac: Fix incorrect location to set real_num_rx|tx_queues")
Reported-by: Christophe ROULLIER <redacted>
Tested-by: Christophe ROULLIER <redacted>
Cc: Alexandre TORGUE <redacted>
Reviewed-by: Ong Boon Leong <redacted>
Signed-off-by: Wong Vee Khee <redacted>
---
v2 changelog:
- Move rtnl_lock() before priv->lock and release it after to avoid a
  possible ABBA deadlock scenario.
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ba855465a2db..c8770e9668a1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5272,6 +5272,7 @@ int stmmac_resume(struct device *dev)
 			return ret;
 	}
 
+	rtnl_lock();
 	mutex_lock(&priv->lock);
 
 	stmmac_reset_queues_param(priv);
@@ -5287,6 +5288,7 @@ int stmmac_resume(struct device *dev)
 	stmmac_enable_all_queues(priv);
 
 	mutex_unlock(&priv->lock);
+	rtnl_unlock();
 
 	if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
 		rtnl_lock();
-- 
2.17.0

Re: [PATCH v2 net 1/1] net: stmmac: Use rtnl_lock/unlock on netif_set_real_num_rx_queues() call

From: patchwork-bot+netdevbpf@kernel.org
Date: 2020-11-17 00:20:07

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun, 15 Nov 2020 15:42:10 +0800 you wrote:
Fix an issue where dump stack is printed on suspend resume flow due to
netif_set_real_num_rx_queues() is not called with rtnl_lock held().

Fixes: 686cff3d7022 ("net: stmmac: Fix incorrect location to set real_num_rx|tx_queues")
Reported-by: Christophe ROULLIER <redacted>
Tested-by: Christophe ROULLIER <redacted>
Cc: Alexandre TORGUE <redacted>
Reviewed-by: Ong Boon Leong <redacted>
Signed-off-by: Wong Vee Khee <redacted>

[...]
Here is the summary with links:
  - [v2,net,1/1] net: stmmac: Use rtnl_lock/unlock on netif_set_real_num_rx_queues() call
    https://git.kernel.org/netdev/net/c/8e5debed3901

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help