dev: Hold rtnl_net_lock() for dev_ifsioc().

Basically, dev_ifsioc() operates on the passed single netns (except
for netdev notifier chains with lower/upper devices for which we will
need more changes).

Let's hold rtnl_net_lock() for dev_ifsioc().

Now that NETDEV_CHANGENAME is always triggered under rtnl_net_lock()
of the device's netns. (do_setlink() and dev_ifsioc())

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250115095545.52709-4-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Kuniyuki Iwashima
2025-01-15 18:55:45 +09:00
committed by Jakub Kicinski
parent 2f1bb1e2cc
commit be94cfdb99
3 changed files with 22 additions and 26 deletions

View File

@@ -27,7 +27,6 @@ static int rtnl_net_debug_event(struct notifier_block *nb,
case NETDEV_CHANGEADDR:
case NETDEV_PRE_CHANGEADDR:
case NETDEV_GOING_DOWN:
case NETDEV_CHANGENAME:
case NETDEV_FEAT_CHANGE:
case NETDEV_BONDING_FAILOVER:
case NETDEV_PRE_UP:
@@ -60,18 +59,10 @@ static int rtnl_net_debug_event(struct notifier_block *nb,
ASSERT_RTNL();
break;
/* Once an event fully supports RTNL_NET, move it here
* and remove "if (0)" below.
*
* case NETDEV_XXX:
* ASSERT_RTNL_NET(net);
* break;
*/
}
/* Just to avoid unused-variable error for dev and net. */
if (0)
case NETDEV_CHANGENAME:
ASSERT_RTNL_NET(net);
break;
}
return NOTIFY_DONE;
}