lkml.org 
[lkml]   [2006]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2006-01-30 10:45    [W:0.036 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site