Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71431
b: refs/heads/master
c: a6f5e06
h: refs/heads/master
i:
  71429: 84c2a82
  71427: a137649
  71423: a710eea
v: v3
  • Loading branch information
Sukadev Bhattiprolu authored and Linus Torvalds committed Oct 19, 2007
1 parent 093e5a7 commit 5ce832a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 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: b460cbc581a53cc088ceba80608021dd49c63c43
refs/heads/master: a6f5e06378970a2687332c2d54046245fcff1e7e
19 changes: 13 additions & 6 deletions trunk/kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,12 @@ 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();
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);
Expand Down Expand Up @@ -1331,6 +1337,9 @@ 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 Expand Up @@ -1395,26 +1404,25 @@ long do_fork(unsigned long clone_flags,
{
struct task_struct *p;
int trace = 0;
struct pid *pid = alloc_pid();
long nr;

if (!pid)
return -EAGAIN;
nr = pid->nr;
if (unlikely(current->ptrace)) {
trace = fork_traceflag (clone_flags);
if (trace)
clone_flags |= CLONE_PTRACE;
}

p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid);
p = copy_process(clone_flags, stack_start, regs, stack_size,
parent_tidptr, child_tidptr, NULL);
/*
* Do this prior waking up the new thread - the thread pointer
* might get invalid after that point, if the thread exits quickly.
*/
if (!IS_ERR(p)) {
struct completion vfork;

nr = pid_nr(task_pid(p));

if (clone_flags & CLONE_VFORK) {
p->vfork_done = &vfork;
init_completion(&vfork);
Expand Down Expand Up @@ -1448,7 +1456,6 @@ long do_fork(unsigned long clone_flags,
}
}
} else {
free_pid(pid);
nr = PTR_ERR(p);
}
return nr;
Expand Down

0 comments on commit 5ce832a

Please sign in to comment.