Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16d95c43 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pid namespace fixes from Eric Biederman:
 "These are two bugs that turn out to have simple fixes that were
  reported during the merge window. Both of these issues have existed
  for a while and it just happens that they both were reported at almost
  the same time"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()
  pid_ns: Sleep in TASK_INTERRUPTIBLE in zap_pid_ns_processes
parents af5d2856 3fd37226
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -1845,11 +1845,13 @@ static __latent_entropy struct task_struct *copy_process(
	*/
	*/
	recalc_sigpending();
	recalc_sigpending();
	if (signal_pending(current)) {
	if (signal_pending(current)) {
		spin_unlock(&current->sighand->siglock);
		write_unlock_irq(&tasklist_lock);
		retval = -ERESTARTNOINTR;
		retval = -ERESTARTNOINTR;
		goto bad_fork_cancel_cgroup;
		goto bad_fork_cancel_cgroup;
	}
	}
	if (unlikely(!(ns_of_pid(pid)->nr_hashed & PIDNS_HASH_ADDING))) {
		retval = -ENOMEM;
		goto bad_fork_cancel_cgroup;
	}


	if (likely(p->pid)) {
	if (likely(p->pid)) {
		ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
		ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
@@ -1907,6 +1909,8 @@ static __latent_entropy struct task_struct *copy_process(
	return p;
	return p;


bad_fork_cancel_cgroup:
bad_fork_cancel_cgroup:
	spin_unlock(&current->sighand->siglock);
	write_unlock_irq(&tasklist_lock);
	cgroup_cancel_fork(p);
	cgroup_cancel_fork(p);
bad_fork_free_pid:
bad_fork_free_pid:
	cgroup_threadgroup_change_end(current);
	cgroup_threadgroup_change_end(current);
+1 −1
Original line number Original line Diff line number Diff line
@@ -277,7 +277,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
	 * if reparented.
	 * if reparented.
	 */
	 */
	for (;;) {
	for (;;) {
		set_current_state(TASK_UNINTERRUPTIBLE);
		set_current_state(TASK_INTERRUPTIBLE);
		if (pid_ns->nr_hashed == init_pids)
		if (pid_ns->nr_hashed == init_pids)
			break;
			break;
		schedule();
		schedule();