mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 19:13:47 +02:00
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 <kuniyu@amazon.com> Link: https://patch.msgid.link/20250114081352.47404-1-kuniyu@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
7a649f39da
commit
2248c05340
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user