From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pid: Don't hash pid 0.
Date: Mon, 30 Jan 2006 13:59:39 +0300 [thread overview]
Message-ID: <43DDF19B.AF498BBD@tv-sign.ru> (raw)
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.
next reply other threads:[~2006-01-30 9:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-30 10:59 Oleg Nesterov [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-01-29 6:31 [PATCH] pid: Don't hash pid 0 Eric W. Biederman
2006-01-29 8:33 ` Andrew Morton
2006-01-29 10:04 ` Eric W. Biederman
2006-01-30 9:29 ` Jan Engelhardt
2006-01-30 9:44 ` Yuki Cuss
2006-01-30 9:49 ` Jan Engelhardt
2006-01-30 9:58 ` Nigel Cunningham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43DDF19B.AF498BBD@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox