Skip to contentSkip to conversation

net: mvneta: fix locking in mvneta_cpu_online()

PATCH Applied Harshit Mogalapalli 4 participants 5 messages Jan 21, 2025 – Jan 23, 2025

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

PATCH 1/1 net: mvneta: fix locking in mvneta_cpu_online()

When port is stopped, unlock before returning

Fixes 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")

---
This is based on static analysis, only compile tested

---
 drivers/net/ethernet/marvell/mvneta.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/mvneta.c +1 -0
index 82f4333fb426..4fe121b9f94b 100644
@@ -4432,6 +4432,7 @@ static int mvneta_cpu_online(unsigned int cpu, struct hlist_node *node)
 	 */
 	if (pp->is_stopped) {
 		spin_unlock(&pp->lock);
+		netdev_unlock(port->napi.dev);
 		return 0;
 	}
 	netif_tx_stop_all_queues(pp->dev);
Signature · 1 line
2.39.3
#1 lore raw

Hi,

Quoted 2 lines · Harshit Mogalapalli

When port is stopped, unlock before returning

Missed adding a period at the end of sentence. Should I send a V2 ?

Thanks,
Harshit

Quoted 20 lines
Fixes 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")

---
This is based on static analysis, only compile tested

---
  drivers/net/ethernet/marvell/mvneta.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/mvneta.c +1 -0
index 82f4333fb426..4fe121b9f94b 100644
@@ -4432,6 +4432,7 @@ static int mvneta_cpu_online(unsigned int cpu, struct hlist_node *node)
  	 */
  	if (pp->is_stopped) {
  		spin_unlock(&pp->lock);
+		netdev_unlock(port->napi.dev);
  		return 0;
  	}
  	netif_tx_stop_all_queues(pp->dev);
maintainer
#2 lore raw
Quoted 4 lines · On Tue, 21 Jan 2025 06:23:16 +0530 Harshit Mogalapalli wrote:
Quoted 2 lines · Harshit Mogalapalli

When port is stopped, unlock before returning

Missed adding a period at the end of sentence. Should I send a V2 ?

It's alright, we can add the period when applying.

reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Harshit Mogalapalli
Quoted 6 lines · Harshit Mogalapalli

When port is stopped, unlock before returning

Fixes 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")

---
This is based on static analysis, only compile tested

Thanks Harshit,

I agree that this is correct.

FWIIW, I would have used the idiomatic approach of a goto to jump to nearly the end of the function, but the effect is the same either way.

#4 lore raw
In reply to Harshit Mogalapalli
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 20 Jan 2025 16:50:02 -0800 you wrote:

When port is stopped, unlock before returning

Fixes 413f0271f396 ("net: protect NAPI enablement with netdev_lock()")

---
This is based on static analysis, only compile tested

[...]

Here is the summary with links:
- net: mvneta: fix locking in mvneta_cpu_online()

    https://git.kernel.org/netdev/net/c/59e00e8ca242

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html