If the list of devices has N elements, netdev_wait_allrefs_any()
is called N times, and linkwatch_forget_dev() is called N*(N-1)/2 times.
Fix this by calling linkwatch_forget_dev() only once per device.
Fixes:
faab39f63c1f ("net: allow out-of-order netdev unregistration")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220218065430.2613262-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
struct net_device *dev;
int wait = 0;
- list_for_each_entry(dev, list, todo_list)
- linkwatch_forget_dev(dev);
-
rebroadcast_time = warning_time = jiffies;
list_for_each_entry(dev, list, todo_list)
}
dev->reg_state = NETREG_UNREGISTERED;
+ linkwatch_forget_dev(dev);
}
while (!list_empty(&list)) {