public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Ken Chen" <kenchen@google.com>
Cc: linux-kernel@vger.kernel.org, morgan@kernel.org
Subject: Re: [patch] fix NPTL thread iterator construct in cap_set_pg()
Date: Thu, 21 Aug 2008 12:18:27 -0700	[thread overview]
Message-ID: <20080821121827.45e44e4f.akpm@linux-foundation.org> (raw)
In-Reply-To: <b040c32a0808150924h2b93529aj803e0b923e1f96f3@mail.gmail.com>

On Fri, 15 Aug 2008 09:24:15 -0700
"Ken Chen" <kenchen@google.com> wrote:

> The usage of while_each_pid_task() construct in cap_set_pg() looks incorrect.
> The macro is meant to form 'do ... while' loop instead of a simple while loop.
> I think currently it will skip thread leader of a NPTL process.
> 
> Fix by convert to 'do ... while' style.
> 
> Signed-off-by: Ken Chen <kenchen@google.com>
> 
> diff --git a/kernel/capability.c b/kernel/capability.c
> index 0101e84..26d8eda 100644
> --- a/kernel/capability.c
> +++ b/kernel/capability.c
> @@ -167,7 +167,7 @@ static inline int cap_set_pg
>  	pgrp = find_vpid(pgrp_nr);
>  	do_each_pid_task(pgrp, PIDTYPE_PGID, g) {
>  		target = g;
> -		while_each_thread(g, target) {
> +		do {
>  			if (!security_capset_check(target, effective,
>  						   inheritable, permitted)) {
>  				security_capset_set(target, effective,
> @@ -175,7 +175,7 @@ static inline int cap_set_pg
>  				ret = 0;
>  			}
>  			found = 1;
> -		}
> +		} while_each_thread(g, target);
>  	} while_each_pid_task(pgrp, PIDTYPE_PGID, g);
> 
>  	read_unlock(&tasklist_lock);

cap_set_pg() gets deleted by the credentials patches in linux-next and
afaict nothing replaced it.

Does this patch actually fix anything?  If not, ignoring it would be a
nice labour-saving device...


  parent reply	other threads:[~2008-08-21 19:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 16:24 [patch] fix NPTL thread iterator construct in cap_set_pg() Ken Chen
2008-08-17 23:29 ` Andrew G. Morgan
2008-08-21 19:18 ` Andrew Morton [this message]
2008-08-21 19:35   ` Ken Chen

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=20080821121827.45e44e4f.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=kenchen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morgan@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