]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/core/dev.c
net: Handle NETREG_UNINITIALIZED devices correctly
[net-next-2.6.git] / net / core / dev.c
index c36a17aafcf3167e8c1f4ed4307f5e4386b7c854..6fe7d739e59bdf1fc4ebe10f427b7c3d0d8308ec 100644 (file)
@@ -4771,21 +4771,23 @@ static void net_set_todo(struct net_device *dev)
 
 static void rollback_registered_many(struct list_head *head)
 {
-       struct net_device *dev;
+       struct net_device *dev, *tmp;
 
        BUG_ON(dev_boot_phase);
        ASSERT_RTNL();
 
-       list_for_each_entry(dev, head, unreg_list) {
+       list_for_each_entry_safe(dev, tmp, head, unreg_list) {
                /* Some devices call without registering
-                * for initialization unwind.
+                * for initialization unwind. Remove those
+                * devices and proceed with the remaining.
                 */
                if (dev->reg_state == NETREG_UNINITIALIZED) {
                        pr_debug("unregister_netdevice: device %s/%p never "
                                 "was registered\n", dev->name, dev);
 
                        WARN_ON(1);
-                       return;
+                       list_del(&dev->unreg_list);
+                       continue;
                }
 
                BUG_ON(dev->reg_state != NETREG_REGISTERED);