aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 92d6b9467314..85cb8bdcfb8f 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -476,6 +476,10 @@ void netdev_unregister_kobject(struct net_device * net)
476 struct device *dev = &(net->dev); 476 struct device *dev = &(net->dev);
477 477
478 kobject_get(&dev->kobj); 478 kobject_get(&dev->kobj);
479
480 if (dev_net(net) != &init_net)
481 return;
482
479 device_del(dev); 483 device_del(dev);
480} 484}
481 485
@@ -501,6 +505,9 @@ int netdev_register_kobject(struct net_device *net)
501#endif 505#endif
502#endif /* CONFIG_SYSFS */ 506#endif /* CONFIG_SYSFS */
503 507
508 if (dev_net(net) != &init_net)
509 return 0;
510
504 return device_add(dev); 511 return device_add(dev);
505} 512}
506 513