From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Linux Containers <containers@lists.osdl.org>,
Pavel Emelyanov <xemul@openvz.org>,
sukadev@us.ibm.com
Subject: Re: [PATCH] pid: sys_wait... fixes (v2)
Date: Thu, 06 Dec 2007 12:11:20 -0700 [thread overview]
Message-ID: <m1fxyfsko7.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20071206184502.GA11752@tv-sign.ru> (Oleg Nesterov's message of "Thu, 6 Dec 2007 21:45:02 +0300")
Oleg Nesterov <oleg@tv-sign.ru> writes:
> On 12/06, Eric W. Biederman wrote:
>>
>> +static struct pid *task_pid_type(struct task_struct *task, enum pid_type
> type)
>> +{
>> + struct pid *pid = NULL;
>> + if (type == PIDTYPE_PID)
>> + pid = task->pids[type].pid;
>> + else if (type < PIDTYPE_MAX)
>> + pid = task->group_leader->pids[type].pid;
>> + return pid;
>> +}
>
> Looks like a useful helper regardless.
Sort of. We don't have any place else that could use it yet.
>> +static int eligible_child(enum pid_type type, struct pid *pid, int options,
>> + struct task_struct *p)
>> {
>> int err;
>> - struct pid_namespace *ns;
>>
>> - ns = current->nsproxy->pid_ns;
>> - if (pid > 0) {
>> - if (task_pid_nr_ns(p, ns) != pid)
>> - return 0;
>> - } else if (!pid) {
>> - if (task_pgrp_nr_ns(p, ns) != task_pgrp_vnr(current))
>> - return 0;
>> - } else if (pid != -1) {
>> - if (task_pgrp_nr_ns(p, ns) != -pid)
>> + if (type < PIDTYPE_MAX) {
>> + if (task_pid_type(p, type) != pid)
>> return 0;
>> }
>
> Minor, minor nit.
>
> If type == PIDTYPE_MAX, pid must be == NULL. but task_pid_type(PIDTYPE_PID)
> also returns NULL. So we can just do
>
> if (task_pid_type(p, type) != pid)
> return 0;
>
> Not that it really makes a difference though.
No.
Your comments are good but I figure this patch is now correct and thus
good enough for me.
Eric
prev parent reply other threads:[~2007-12-06 19:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 3:14 [PATCH] pid: sys_wait... fixes Eric W. Biederman
2007-12-06 17:01 ` Oleg Nesterov
2007-12-06 17:21 ` Eric W. Biederman
2007-12-06 18:20 ` [PATCH] pid: sys_wait... fixes (v2) Eric W. Biederman
2007-12-06 18:45 ` Oleg Nesterov
2007-12-06 19:11 ` Eric W. Biederman [this message]
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=m1fxyfsko7.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=sukadev@us.ibm.com \
--cc=xemul@openvz.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;
as well as URLs for NNTP newsgroup(s).