summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/pid_namespace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 3cc29b830e9e..0dbbc66b6ec6 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -146,6 +146,8 @@ struct pid_namespace *copy_pid_ns(unsigned long flags,
return get_pid_ns(old_ns);
if (flags & (CLONE_THREAD|CLONE_PARENT))
return ERR_PTR(-EINVAL);
+ if (task_active_pid_ns(current) != old_ns)
+ return ERR_PTR(-EINVAL);
return create_pid_namespace(user_ns, old_ns);
}