rtnetlink: call ->dellink on failure when ->newlink exists
[pandora-kernel.git] / net / core / rtnetlink.c
index 2c51dfb..5b412f0 100644 (file)
@@ -1860,8 +1860,16 @@ replay:
                        goto out;
 
                err = rtnl_configure_link(dev, ifm);
-               if (err < 0)
-                       unregister_netdevice(dev);
+               if (err < 0) {
+                       if (ops->newlink) {
+                               LIST_HEAD(list_kill);
+
+                               ops->dellink(dev, &list_kill);
+                               unregister_netdevice_many(&list_kill);
+                       } else {
+                               unregister_netdevice(dev);
+                       }
+               }
 out:
                put_net(dest_net);
                return err;