aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/fork.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 6031800c94cf..cf13c44f3da3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -956,7 +956,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
956 unsigned long stack_size, 956 unsigned long stack_size,
957 int __user *parent_tidptr, 957 int __user *parent_tidptr,
958 int __user *child_tidptr, 958 int __user *child_tidptr,
959 int pid) 959 struct pid *pid)
960{ 960{
961 int retval; 961 int retval;
962 struct task_struct *p = NULL; 962 struct task_struct *p = NULL;
@@ -1023,7 +1023,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1023 p->did_exec = 0; 1023 p->did_exec = 0;
1024 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ 1024 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
1025 copy_flags(clone_flags, p); 1025 copy_flags(clone_flags, p);
1026 p->pid = pid; 1026 p->pid = pid_nr(pid);
1027 retval = -EFAULT; 1027 retval = -EFAULT;
1028 if (clone_flags & CLONE_PARENT_SETTID) 1028 if (clone_flags & CLONE_PARENT_SETTID)
1029 if (put_user(p->pid, parent_tidptr)) 1029 if (put_user(p->pid, parent_tidptr))
@@ -1261,7 +1261,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1261 list_add_tail_rcu(&p->tasks, &init_task.tasks); 1261 list_add_tail_rcu(&p->tasks, &init_task.tasks);
1262 __get_cpu_var(process_counts)++; 1262 __get_cpu_var(process_counts)++;
1263 } 1263 }
1264 attach_pid(p, PIDTYPE_PID, find_pid(p->pid)); 1264 attach_pid(p, PIDTYPE_PID, pid);
1265 nr_threads++; 1265 nr_threads++;
1266 } 1266 }
1267 1267
@@ -1325,7 +1325,8 @@ struct task_struct * __cpuinit fork_idle(int cpu)
1325 struct task_struct *task; 1325 struct task_struct *task;
1326 struct pt_regs regs; 1326 struct pt_regs regs;
1327 1327
1328 task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL, 0); 1328 task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL,
1329 &init_struct_pid);
1329 if (!IS_ERR(task)) 1330 if (!IS_ERR(task))
1330 init_idle(task, cpu); 1331 init_idle(task, cpu);
1331 1332
@@ -1375,7 +1376,7 @@ long do_fork(unsigned long clone_flags,
1375 clone_flags |= CLONE_PTRACE; 1376 clone_flags |= CLONE_PTRACE;
1376 } 1377 }
1377 1378
1378 p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, nr); 1379 p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid);
1379 /* 1380 /*
1380 * Do this prior waking up the new thread - the thread pointer 1381 * Do this prior waking up the new thread - the thread pointer
1381 * might get invalid after that point, if the thread exits quickly. 1382 * might get invalid after that point, if the thread exits quickly.