net: Hold rtnl_net_lock() in (un)?register_netdevice_notifier_net().
(un)?register_netdevice_notifier_net() hold RTNL before triggering the notifier for all netdev in the netns. Let's convert the RTNL to rtnl_net_lock(). Note that the per-netns netdev notifier is protected by per-netns RTNL. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250106070751.63146-3-kuniyu@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a239e06250
commit
ca779f4065
1 changed files with 6 additions and 4 deletions
|
@ -1897,9 +1897,10 @@ int register_netdevice_notifier_net(struct net *net, struct notifier_block *nb)
|
|||
{
|
||||
int err;
|
||||
|
||||
rtnl_lock();
|
||||
rtnl_net_lock(net);
|
||||
err = __register_netdevice_notifier_net(net, nb, false);
|
||||
rtnl_unlock();
|
||||
rtnl_net_unlock(net);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(register_netdevice_notifier_net);
|
||||
|
@ -1925,9 +1926,10 @@ int unregister_netdevice_notifier_net(struct net *net,
|
|||
{
|
||||
int err;
|
||||
|
||||
rtnl_lock();
|
||||
rtnl_net_lock(net);
|
||||
err = __unregister_netdevice_notifier_net(net, nb);
|
||||
rtnl_unlock();
|
||||
rtnl_net_unlock(net);
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(unregister_netdevice_notifier_net);
|
||||
|
|
Loading…
Add table
Reference in a new issue