pids: fix fork_idle() to setup ->pids correctly
Changes
1 files changed · +13 −1
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| kernel/fork.c | modified | +13 | −1 | View file |
kernel/fork.c
View filediff --git a/kernel/fork.c b/kernel/fork.c
index d32410b..bf9fef6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1338,6 +1338,16 @@ noinline struct pt_regs * __cpuinit __attribute__((weak)) idle_regs(struct pt_re
return regs;
}
+static inline void init_idle_pids(struct pid_link *links)
+{
+ enum pid_type type;
+
+ for (type = PIDTYPE_PID; type < PIDTYPE_MAX; ++type) {
+ INIT_HLIST_NODE(&links[type].node); /* not really needed */
+ links[type].pid = &init_struct_pid;
+ }
+}
+
struct task_struct * __cpuinit fork_idle(int cpu)
{
struct task_struct *task;
@@ -1345,8 +1355,10 @@ struct task_struct * __cpuinit fork_idle(int cpu)
task = copy_process(CLONE_VM, 0, idle_regs(®s), 0, NULL,
&init_struct_pid, 0);
- if (!IS_ERR(task))
+ if (!IS_ERR(task)) {
+ init_idle_pids(task->pids);
init_idle(task, cpu);
+ }
return task;
}