Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71450
b: refs/heads/master
c: 425fb2b
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Oct 19, 2007
1 parent 29d0ed0 commit 7df0302
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 198fe21b0a17fe9c68cb519ecc566534b04f122b
refs/heads/master: 425fb2b4bf5dde24be4a82e9a2c344bb49ac92e4
31 changes: 16 additions & 15 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,16 +1040,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
if (p->binfmt && !try_module_get(p->binfmt->module))
goto bad_fork_cleanup_put_domain;

if (pid != &init_struct_pid) {
pid = alloc_pid(task_active_pid_ns(p));
if (!pid)
goto bad_fork_put_binfmt_module;
}

p->did_exec = 0;
delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
copy_flags(clone_flags, p);
p->pid = pid_nr(pid);
retval = -EFAULT;
if (clone_flags & CLONE_PARENT_SETTID)
if (put_user(p->pid, parent_tidptr))
Expand Down Expand Up @@ -1133,10 +1126,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->blocked_on = NULL; /* not blocked yet */
#endif

p->tgid = p->pid;
if (clone_flags & CLONE_THREAD)
p->tgid = current->tgid;

if ((retval = security_task_alloc(p)))
goto bad_fork_cleanup_policy;
if ((retval = audit_alloc(p)))
Expand All @@ -1162,6 +1151,18 @@ static struct task_struct *copy_process(unsigned long clone_flags,
if (retval)
goto bad_fork_cleanup_namespaces;

if (pid != &init_struct_pid) {
retval = -ENOMEM;
pid = alloc_pid(task_active_pid_ns(p));
if (!pid)
goto bad_fork_cleanup_namespaces;
}

p->pid = pid_nr(pid);
p->tgid = p->pid;
if (clone_flags & CLONE_THREAD)
p->tgid = current->tgid;

p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
/*
* Clear TID on mm_release()?
Expand Down Expand Up @@ -1259,7 +1260,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
spin_unlock(&current->sighand->siglock);
write_unlock_irq(&tasklist_lock);
retval = -ERESTARTNOINTR;
goto bad_fork_cleanup_namespaces;
goto bad_fork_free_pid;
}

if (clone_flags & CLONE_THREAD) {
Expand Down Expand Up @@ -1308,6 +1309,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
cgroup_post_fork(p);
return p;

bad_fork_free_pid:
if (pid != &init_struct_pid)
free_pid(pid);
bad_fork_cleanup_namespaces:
exit_task_namespaces(p);
bad_fork_cleanup_keys:
Expand Down Expand Up @@ -1337,9 +1341,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
cgroup_exit(p, cgroup_callbacks_done);
bad_fork_cleanup_delays_binfmt:
delayacct_tsk_free(p);
if (pid != &init_struct_pid)
free_pid(pid);
bad_fork_put_binfmt_module:
if (p->binfmt)
module_put(p->binfmt->module);
bad_fork_cleanup_put_domain:
Expand Down

0 comments on commit 7df0302

Please sign in to comment.