diff options
author | Mark Brown <broonie@kernel.org> | 2014-10-06 17:33:43 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-06 17:33:43 +0100 |
commit | 4a105b2f855d956b419c513e1f3212a9ac1d27f5 (patch) | |
tree | 5be5404ed57e81b8dab01db2666213ecb176f58f /kernel/fork.c | |
parent | defd110d5c8bd987868c8269f8dc7860fd6daec1 (diff) | |
parent | 0ee8bb9c4864ee826e6c669f230562cd0fed8722 (diff) |
Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 76665c42028b..906b36bea046 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1071,6 +1071,11 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) sig->nr_threads = 1; atomic_set(&sig->live, 1); atomic_set(&sig->sigcnt, 1); + + /* list_add(thread_node, thread_head) without INIT_LIST_HEAD() */ + sig->thread_head = (struct list_head)LIST_HEAD_INIT(tsk->thread_node); + tsk->thread_node = (struct list_head)LIST_HEAD_INIT(sig->thread_head); + init_waitqueue_head(&sig->wait_chldexit); sig->curr_target = tsk; init_sigpending(&sig->shared_pending); @@ -1512,14 +1517,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, goto bad_fork_free_pid; } - if (clone_flags & CLONE_THREAD) { - current->signal->nr_threads++; - atomic_inc(¤t->signal->live); - atomic_inc(¤t->signal->sigcnt); - p->group_leader = current->group_leader; - list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); - } - if (likely(p->pid)) { ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); @@ -1536,6 +1533,15 @@ static struct task_struct *copy_process(unsigned long clone_flags, list_add_tail(&p->sibling, &p->real_parent->children); list_add_tail_rcu(&p->tasks, &init_task.tasks); __this_cpu_inc(process_counts); + } else { + current->signal->nr_threads++; + atomic_inc(¤t->signal->live); + atomic_inc(¤t->signal->sigcnt); + p->group_leader = current->group_leader; + list_add_tail_rcu(&p->thread_group, + &p->group_leader->thread_group); + list_add_tail_rcu(&p->thread_node, + &p->signal->thread_head); } attach_pid(p, PIDTYPE_PID, pid); nr_threads++; |