diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/core/net_namespace.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 763674e1e593..72b4c184dd84 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
| @@ -35,7 +35,9 @@ static __net_init int setup_net(struct net *net) | |||
| 35 | struct net_generic *ng; | 35 | struct net_generic *ng; |
| 36 | 36 | ||
| 37 | atomic_set(&net->count, 1); | 37 | atomic_set(&net->count, 1); |
| 38 | #ifdef NETNS_REFCNT_DEBUG | ||
| 38 | atomic_set(&net->use_count, 0); | 39 | atomic_set(&net->use_count, 0); |
| 40 | #endif | ||
| 39 | 41 | ||
| 40 | error = -ENOMEM; | 42 | error = -ENOMEM; |
| 41 | ng = kzalloc(sizeof(struct net_generic) + | 43 | ng = kzalloc(sizeof(struct net_generic) + |
| @@ -86,11 +88,13 @@ static void net_free(struct net *net) | |||
| 86 | if (!net) | 88 | if (!net) |
| 87 | return; | 89 | return; |
| 88 | 90 | ||
| 91 | #ifdef NETNS_REFCNT_DEBUG | ||
| 89 | if (unlikely(atomic_read(&net->use_count) != 0)) { | 92 | if (unlikely(atomic_read(&net->use_count) != 0)) { |
| 90 | printk(KERN_EMERG "network namespace not free! Usage: %d\n", | 93 | printk(KERN_EMERG "network namespace not free! Usage: %d\n", |
| 91 | atomic_read(&net->use_count)); | 94 | atomic_read(&net->use_count)); |
| 92 | return; | 95 | return; |
| 93 | } | 96 | } |
| 97 | #endif | ||
| 94 | 98 | ||
| 95 | kmem_cache_free(net_cachep, net); | 99 | kmem_cache_free(net_cachep, net); |
| 96 | } | 100 | } |
