aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/veth.c14
-rw-r--r--net/core/rtnetlink.c5
2 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 43af9e9b2652..3f67a29593bc 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -459,19 +459,7 @@ static __init int veth_init(void)
459 459
460static __exit void veth_exit(void) 460static __exit void veth_exit(void)
461{ 461{
462 struct veth_priv *priv, *next; 462 rtnl_link_unregister(&veth_link_ops);
463
464 rtnl_lock();
465 /*
466 * cannot trust __rtnl_link_unregister() to unregister all
467 * devices, as each ->dellink call will remove two devices
468 * from the list at once.
469 */
470 list_for_each_entry_safe(priv, next, &veth_list, list)
471 veth_dellink(priv->dev);
472
473 __rtnl_link_unregister(&veth_link_ops);
474 rtnl_unlock();
475} 463}
476 464
477module_init(veth_init); 465module_init(veth_init);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1ba26fb4bf2..fed95a323b28 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -308,9 +308,12 @@ void __rtnl_link_unregister(struct rtnl_link_ops *ops)
308 struct net *net; 308 struct net *net;
309 309
310 for_each_net(net) { 310 for_each_net(net) {
311restart:
311 for_each_netdev_safe(net, dev, n) { 312 for_each_netdev_safe(net, dev, n) {
312 if (dev->rtnl_link_ops == ops) 313 if (dev->rtnl_link_ops == ops) {
313 ops->dellink(dev); 314 ops->dellink(dev);
315 goto restart;
316 }
314 } 317 }
315 } 318 }
316 list_del(&ops->list); 319 list_del(&ops->list);