aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2007-08-31 02:56:27 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-31 04:42:22 -0400
commitb07e35f94a7b6a059f889b904529ee907dc0634d (patch)
tree0d6178552b4232fa4ea7c3d49aa4710873babc11
parent5d540fb71552b9f2c542bea967200c48be2d8ef6 (diff)
setpgid(child) fails if the child was forked by sub-thread
Spotted by Marcin Kowalczyk <qrczak@knm.org.pl>. sys_setpgid(child) fails if the child was forked by sub-thread. Fix the "is it our child" check. The previous commit ee0acf90d320c29916ba8c5c1b2e908d81f5057d was not complete. (this patch asks for the new same_thread_group() helper, but mainline doesn't have it yet). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> Cc: <stable@kernel.org> Tested-by: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/sys.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 449b81b98b3d..1b33b05d346b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1442,7 +1442,6 @@ asmlinkage long sys_times(struct tms __user * tbuf)
1442 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. 1442 * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
1443 * LBT 04.03.94 1443 * LBT 04.03.94
1444 */ 1444 */
1445
1446asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) 1445asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
1447{ 1446{
1448 struct task_struct *p; 1447 struct task_struct *p;
@@ -1470,7 +1469,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
1470 if (!thread_group_leader(p)) 1469 if (!thread_group_leader(p))
1471 goto out; 1470 goto out;
1472 1471
1473 if (p->real_parent == group_leader) { 1472 if (p->real_parent->tgid == group_leader->tgid) {
1474 err = -EPERM; 1473 err = -EPERM;
1475 if (task_session(p) != task_session(group_leader)) 1474 if (task_session(p) != task_session(group_leader))
1476 goto out; 1475 goto out;