diff options
Diffstat (limited to 'kernel/pid_namespace.c')
| -rw-r--r-- | kernel/pid_namespace.c | 12 | 
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 42086551a24..db95d8eb761 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -132,6 +132,12 @@ out:  	return ERR_PTR(err);  } +static void delayed_free_pidns(struct rcu_head *p) +{ +	kmem_cache_free(pid_ns_cachep, +			container_of(p, struct pid_namespace, rcu)); +} +  static void destroy_pid_namespace(struct pid_namespace *ns)  {  	int i; @@ -140,7 +146,7 @@ static void destroy_pid_namespace(struct pid_namespace *ns)  	for (i = 0; i < PIDMAP_ENTRIES; i++)  		kfree(ns->pidmap[i].page);  	put_user_ns(ns->user_ns); -	kmem_cache_free(pid_ns_cachep, ns); +	call_rcu(&ns->rcu, delayed_free_pidns);  }  struct pid_namespace *copy_pid_ns(unsigned long flags, @@ -312,7 +318,9 @@ static void *pidns_get(struct task_struct *task)  	struct pid_namespace *ns;  	rcu_read_lock(); -	ns = get_pid_ns(task_active_pid_ns(task)); +	ns = task_active_pid_ns(task); +	if (ns) +		get_pid_ns(ns);  	rcu_read_unlock();  	return ns;  | 
