Skip to contentSkip to conversation

PATCH userns: release the reference of user_ns when destroying a pid_ns

PATCH Zhao Hongjiang 1 participant 1 message Nov 2, 2012 Namespaces:

lore
Share & tools
lore
#0 lore raw

From: Zhao Hongjiang <[email protected]>

We should release the reference of user_ns which belong to the pid_ns when the pid_ns's reference is down to zero, because when we create a new pid_ns we get the reference of the user_ns.

---
 kernel/pid_namespace.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/pid_namespace.c +1 -0
index 2d6010a..f303462 100644
@@ -127,6 +127,7 @@ static void destroy_pid_namespace(struct pid_namespace *ns)
 {
 	int i;
 
+	put_user_ns(ns->user_ns);
 	proc_free_inum(ns->proc_inum);
 	for (i = 0; i < PIDMAP_ENTRIES; i++)
 		kfree(ns->pidmap[i].page);

-- 1.7.1