net: loopback: Hold rtnl_net_lock() in blackhole_netdev_init().
Subsystems (2)
PATCH 1/1 net: loopback: Hold rtnl_net_lock() in blackhole_netdev_init().
blackhole_netdev is the global device in init_net.
Let's hold rtnl_net_lock(&init_net) in blackhole_netdev_init().
While at it, the unnecessary dev_net_set() call is removed, which is done in alloc_netdev_mqs().
Signed-off-by Kuniyuki Iwashima <[email protected]>
--- drivers/net/loopback.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/loopback.c +2 -3
@@ -264,13 +264,12 @@ static int __init blackhole_netdev_init(void)if (!blackhole_netdev)return -ENOMEM ; -rtnl_lock (); +rtnl_net_lock (&init_net);dev_init_scheduler (blackhole_netdev);dev_activate (blackhole_netdev); -rtnl_unlock (); +rtnl_net_unlock (&init_net); blackhole_netdev->flags |=IFF_UP |IFF_RUNNING ; -dev_net_set (blackhole_netdev, &init_net);return 0 ; }
Signature · 1 line
2.39.5 (Apple Git-154)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 14 Jan 2025 17:13:52 +0900 you wrote:
blackhole_netdevis the global device ininit_net.Let's hold
rtnl_net_lock(&init_net)inblackhole_netdev_init().While at it, the unnecessary
dev_net_set()call is removed, which is done inalloc_netdev_mqs().[...]
Here is the summary with links:
- [v1,net-next] net: loopback: Hold rtnl_net_lock() in blackhole_netdev_init().
https://git.kernel.org/netdev/net-next/c/2248c05340a6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html