aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index cc5be0d01ce6..b9c54318a292 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1922,6 +1922,12 @@ static __latent_entropy struct task_struct *copy_process(
1922 1922
1923 rseq_fork(p, clone_flags); 1923 rseq_fork(p, clone_flags);
1924 1924
1925 /* Don't start children in a dying pid namespace */
1926 if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) {
1927 retval = -ENOMEM;
1928 goto bad_fork_cancel_cgroup;
1929 }
1930
1925 /* 1931 /*
1926 * Process group and session signals need to be delivered to just the 1932 * Process group and session signals need to be delivered to just the
1927 * parent before the fork or both the parent and the child after the 1933 * parent before the fork or both the parent and the child after the
@@ -1935,10 +1941,7 @@ static __latent_entropy struct task_struct *copy_process(
1935 retval = -ERESTARTNOINTR; 1941 retval = -ERESTARTNOINTR;
1936 goto bad_fork_cancel_cgroup; 1942 goto bad_fork_cancel_cgroup;
1937 } 1943 }
1938 if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) { 1944
1939 retval = -ENOMEM;
1940 goto bad_fork_cancel_cgroup;
1941 }
1942 1945
1943 init_task_pid_links(p); 1946 init_task_pid_links(p);
1944 if (likely(p->pid)) { 1947 if (likely(p->pid)) {