pid: Don't hash pid 0.
kernel/pid.c int fastcall attach_pid(task_t *task, en · line 156
Quoted 13 lines · Eric W. Biederman
kernel/pid.c +3
-0@@ -148,6 +148,9 @@ int fastcall attach_pid(task_t *task, en {struct pid *pid, *task_pid; +if (!nr) + goto out; + task_pid = &task->pids[type]; pid =find_pid (type, nr); task_pid->nr = nr;
If nr == 0 then task_pid->nr is uninitialized, so
kernel/pid.c static fastcall int __detach_pid(task_t · line 176
Quoted 6 lines
kernel/pid.c +2
-0@@ -169,6 +172,9 @@ static fastcall int __detach_pid(task_tint nr =0 ; pid = &task->pids[type]; +if (!pid->nr) + goto out;
this is unsafe.
Yes, INIT_TASK() sets pids[...].nr == 0, but this is fragile and at least needs a comment.
Eric, Andrew, I think I have a better patch, will post in a minute.
Oleg.