diff options
-rw-r--r-- | net/core/net_namespace.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index e9f0964ce70b..3f6d37deac45 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -64,6 +64,20 @@ static struct net *net_alloc(void) | |||
64 | return kmem_cache_zalloc(net_cachep, GFP_KERNEL); | 64 | return kmem_cache_zalloc(net_cachep, GFP_KERNEL); |
65 | } | 65 | } |
66 | 66 | ||
67 | static void net_free(struct net *net) | ||
68 | { | ||
69 | if (!net) | ||
70 | return; | ||
71 | |||
72 | if (unlikely(atomic_read(&net->use_count) != 0)) { | ||
73 | printk(KERN_EMERG "network namespace not free! Usage: %d\n", | ||
74 | atomic_read(&net->use_count)); | ||
75 | return; | ||
76 | } | ||
77 | |||
78 | kmem_cache_free(net_cachep, net); | ||
79 | } | ||
80 | |||
67 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) | 81 | struct net *copy_net_ns(unsigned long flags, struct net *old_net) |
68 | { | 82 | { |
69 | struct net *new_net = NULL; | 83 | struct net *new_net = NULL; |
@@ -100,20 +114,6 @@ out: | |||
100 | return new_net; | 114 | return new_net; |
101 | } | 115 | } |
102 | 116 | ||
103 | static void net_free(struct net *net) | ||
104 | { | ||
105 | if (!net) | ||
106 | return; | ||
107 | |||
108 | if (unlikely(atomic_read(&net->use_count) != 0)) { | ||
109 | printk(KERN_EMERG "network namespace not free! Usage: %d\n", | ||
110 | atomic_read(&net->use_count)); | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | kmem_cache_free(net_cachep, net); | ||
115 | } | ||
116 | |||
117 | static void cleanup_net(struct work_struct *work) | 117 | static void cleanup_net(struct work_struct *work) |
118 | { | 118 | { |
119 | struct pernet_operations *ops; | 119 | struct pernet_operations *ops; |