From: Andrew Morton Cc: Guillaume Thouvenin Signed-off-by: Andrew Morton --- kernel/fork.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff -puN kernel/fork.c~connector-add-a-fork-connector-use-after-free-fix kernel/fork.c --- 25/kernel/fork.c~connector-add-a-fork-connector-use-after-free-fix 2005-06-26 13:42:40.000000000 -0700 +++ 25-akpm/kernel/fork.c 2005-06-26 13:42:40.000000000 -0700 @@ -1251,14 +1251,15 @@ long do_fork(unsigned long clone_flags, ptrace_notify ((trace << 8) | SIGTRAP); } + fork_connector(current->tgid, current->pid, p->tgid, p->pid); + if (clone_flags & CLONE_VFORK) { + wait_for_completion(&vfork); if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) - ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); + ptrace_notify((PTRACE_EVENT_VFORK_DONE << 8) | + SIGTRAP); } - - fork_connector(current->tgid, current->pid, - p->tgid, p->pid); } else { free_pidmap(pid); pid = PTR_ERR(p); _