Messages in this thread | | | Date | Mon, 30 Jan 2006 13:59:39 +0300 | From | Oleg Nesterov <> | Subject | Re: [PATCH] pid: Don't hash pid 0. |
| |
Eric W. Biederman wrote: > > --- a/kernel/pid.c > +++ b/kernel/pid.c > @@ -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
> @@ -169,6 +172,9 @@ static fastcall int __detach_pid(task_t > int 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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |