diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d334446a8eaf..a1607bc0cd4c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -994,6 +994,8 @@ int dev_open(struct net_device *dev) | |||
994 | { | 994 | { |
995 | int ret = 0; | 995 | int ret = 0; |
996 | 996 | ||
997 | ASSERT_RTNL(); | ||
998 | |||
997 | /* | 999 | /* |
998 | * Is it already up? | 1000 | * Is it already up? |
999 | */ | 1001 | */ |
@@ -1060,6 +1062,8 @@ int dev_open(struct net_device *dev) | |||
1060 | */ | 1062 | */ |
1061 | int dev_close(struct net_device *dev) | 1063 | int dev_close(struct net_device *dev) |
1062 | { | 1064 | { |
1065 | ASSERT_RTNL(); | ||
1066 | |||
1063 | might_sleep(); | 1067 | might_sleep(); |
1064 | 1068 | ||
1065 | if (!(dev->flags & IFF_UP)) | 1069 | if (!(dev->flags & IFF_UP)) |
@@ -4480,17 +4484,19 @@ static void __net_exit default_device_exit(struct net *net) | |||
4480 | rtnl_lock(); | 4484 | rtnl_lock(); |
4481 | for_each_netdev_safe(net, dev, next) { | 4485 | for_each_netdev_safe(net, dev, next) { |
4482 | int err; | 4486 | int err; |
4487 | char fb_name[IFNAMSIZ]; | ||
4483 | 4488 | ||
4484 | /* Ignore unmoveable devices (i.e. loopback) */ | 4489 | /* Ignore unmoveable devices (i.e. loopback) */ |
4485 | if (dev->features & NETIF_F_NETNS_LOCAL) | 4490 | if (dev->features & NETIF_F_NETNS_LOCAL) |
4486 | continue; | 4491 | continue; |
4487 | 4492 | ||
4488 | /* Push remaing network devices to init_net */ | 4493 | /* Push remaing network devices to init_net */ |
4489 | err = dev_change_net_namespace(dev, &init_net, "dev%d"); | 4494 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); |
4495 | err = dev_change_net_namespace(dev, &init_net, fb_name); | ||
4490 | if (err) { | 4496 | if (err) { |
4491 | printk(KERN_WARNING "%s: failed to move %s to init_net: %d\n", | 4497 | printk(KERN_EMERG "%s: failed to move %s to init_net: %d\n", |
4492 | __func__, dev->name, err); | 4498 | __func__, dev->name, err); |
4493 | unregister_netdevice(dev); | 4499 | BUG(); |
4494 | } | 4500 | } |
4495 | } | 4501 | } |
4496 | rtnl_unlock(); | 4502 | rtnl_unlock(); |