Skip to contentSkip to conversation

net: stmmac: Use rtnl_lock/unlock on netif_set_real_num_rx_queues() call

PATCH Applied Wong Vee Khee 2 participants 2 messages Nov 15, 2020 – Nov 17, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

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")
Cc Alexandre TORGUE <[email protected]>

---
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(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -0
index ba855465a2db..c8770e9668a1 100644
@@ -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();
Signature · 1 line
2.17.0
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

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

Quoted 11 lines · 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")
Cc Alexandre TORGUE <[email protected]>

[...]

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