Re: [PATCH] pid: Don't hash pid 0.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux