]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/core/dev.c
net: Fix userspace RTM_NEWLINK notifications.
[karo-tx-linux.git] / net / core / dev.c
index 6fe7d739e59bdf1fc4ebe10f427b7c3d0d8308ec..be9924f60ec34bafa135916455595e794a7fe86c 100644 (file)
@@ -5035,6 +5035,11 @@ int register_netdevice(struct net_device *dev)
                rollback_registered(dev);
                dev->reg_state = NETREG_UNREGISTERED;
        }
+       /*
+        *      Prevent userspace races by waiting until the network
+        *      device is fully setup before sending notifications.
+        */
+       rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
 
 out:
        return ret;
@@ -5597,6 +5602,12 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
        /* Notify protocols, that a new device appeared. */
        call_netdevice_notifiers(NETDEV_REGISTER, dev);
 
+       /*
+        *      Prevent userspace races by waiting until the network
+        *      device is fully setup before sending notifications.
+        */
+       rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
+
        synchronize_net();
        err = 0;
 out: