From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: Cedric Le Goater <clg@fr.ibm.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Jeff Dike <jdike@addtoit.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] sys_setpgid: eliminate unnecessary do_each_task_pid(PIDTYPE_PGID)
Date: Mon, 23 Oct 2006 21:51:52 +0400 [thread overview]
Message-ID: <20061023175152.GA115@oleg> (raw)
On top of add-process_session-helper-routine.patch
All tasks in the process group have the same sid, we don't need to iterate
them all to check that the caller of sys_setpgid() doesn't change its session.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- rc2-mm2/kernel/sys.c~ 2006-10-22 19:28:17.000000000 +0400
+++ rc2-mm2/kernel/sys.c 2006-10-23 20:35:56.000000000 +0400
@@ -1398,16 +1398,13 @@ asmlinkage long sys_setpgid(pid_t pid, p
goto out;
if (pgid != pid) {
- struct task_struct *p;
+ struct task_struct *g =
+ find_task_by_pid_type(PIDTYPE_PGID, pgid);
- do_each_task_pid(pgid, PIDTYPE_PGID, p) {
- if (process_session(p) == process_session(group_leader))
- goto ok_pgid;
- } while_each_task_pid(pgid, PIDTYPE_PGID, p);
- goto out;
+ if (!g || process_session(g) != process_session(group_leader))
+ goto out;
}
-ok_pgid:
err = security_task_setpgid(p, pgid);
if (err)
goto out;
reply other threads:[~2006-10-23 17:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20061023175152.GA115@oleg \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=clg@fr.ibm.com \
--cc=ebiederm@xmission.com \
--cc=jdike@addtoit.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