aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--net/core/dev.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8b17ed40dea2..7c1d4466583b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -758,7 +758,8 @@ static inline
758void dev_net_set(struct net_device *dev, struct net *net) 758void dev_net_set(struct net_device *dev, struct net *net)
759{ 759{
760#ifdef CONFIG_NET_NS 760#ifdef CONFIG_NET_NS
761 dev->nd_net = net; 761 release_net(dev->nd_net);
762 dev->nd_net = hold_net(net);
762#endif 763#endif
763} 764}
764 765
diff --git a/net/core/dev.c b/net/core/dev.c
index 7aa01125287e..77530e9a34fc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4042,6 +4042,8 @@ EXPORT_SYMBOL(alloc_netdev_mq);
4042 */ 4042 */
4043void free_netdev(struct net_device *dev) 4043void free_netdev(struct net_device *dev)
4044{ 4044{
4045 release_net(dev_net(dev));
4046
4045 /* Compatibility with error handling in drivers */ 4047 /* Compatibility with error handling in drivers */
4046 if (dev->reg_state == NETREG_UNINITIALIZED) { 4048 if (dev->reg_state == NETREG_UNINITIALIZED) {
4047 kfree((char *)dev - dev->padded); 4049 kfree((char *)dev - dev->padded);