|
@@ -1922,6 +1922,12 @@ static __latent_entropy struct task_struct *copy_process(
|
|
|
|
|
|
rseq_fork(p, clone_flags);
|
|
|
|
|
|
+ /* Don't start children in a dying pid namespace */
|
|
|
+ if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) {
|
|
|
+ retval = -ENOMEM;
|
|
|
+ goto bad_fork_cancel_cgroup;
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* Process group and session signals need to be delivered to just the
|
|
|
* 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(
|
|
|
retval = -ERESTARTNOINTR;
|
|
|
goto bad_fork_cancel_cgroup;
|
|
|
}
|
|
|
- if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) {
|
|
|
- retval = -ENOMEM;
|
|
|
- goto bad_fork_cancel_cgroup;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
init_task_pid_links(p);
|
|
|
if (likely(p->pid)) {
|