aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--kernel/pid_namespace.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index e2772666f004..7246ef3d4455 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -23,6 +23,7 @@ struct bsd_acct_struct;
23struct pid_namespace { 23struct pid_namespace {
24 struct kref kref; 24 struct kref kref;
25 struct pidmap pidmap[PIDMAP_ENTRIES]; 25 struct pidmap pidmap[PIDMAP_ENTRIES];
26 struct rcu_head rcu;
26 int last_pid; 27 int last_pid;
27 unsigned int nr_hashed; 28 unsigned int nr_hashed;
28 struct task_struct *child_reaper; 29 struct task_struct *child_reaper;
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 42086551a24a..06c62de9c711 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -132,6 +132,12 @@ out:
132 return ERR_PTR(err); 132 return ERR_PTR(err);
133} 133}
134 134
135static void delayed_free_pidns(struct rcu_head *p)
136{
137 kmem_cache_free(pid_ns_cachep,
138 container_of(p, struct pid_namespace, rcu));
139}
140
135static void destroy_pid_namespace(struct pid_namespace *ns) 141static void destroy_pid_namespace(struct pid_namespace *ns)
136{ 142{
137 int i; 143 int i;
@@ -140,7 +146,7 @@ static void destroy_pid_namespace(struct pid_namespace *ns)
140 for (i = 0; i < PIDMAP_ENTRIES; i++) 146 for (i = 0; i < PIDMAP_ENTRIES; i++)
141 kfree(ns->pidmap[i].page); 147 kfree(ns->pidmap[i].page);
142 put_user_ns(ns->user_ns); 148 put_user_ns(ns->user_ns);
143 kmem_cache_free(pid_ns_cachep, ns); 149 call_rcu(&ns->rcu, delayed_free_pidns);
144} 150}
145 151
146struct pid_namespace *copy_pid_ns(unsigned long flags, 152struct pid_namespace *copy_pid_ns(unsigned long flags,