Commit 56a35d83 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Willy Tarreau

[PATCH] setpgid(child) fails if the child was forked by sub-thread

commit b07e35f9 in mainline tree

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
ee0acf90 was not complete.

(this patch asks for the new same_thread_group() helper, but mainline doesn't
 have it yet).
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
Tested-by: default avatar"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2fe3251c
......@@ -1358,7 +1358,6 @@ asmlinkage long sys_times(struct tms __user * tbuf)
* Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
* LBT 04.03.94
*/
asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
{
struct task_struct *p;
......@@ -1386,7 +1385,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
if (!thread_group_leader(p))
goto out;
if (p->real_parent == group_leader) {
if (p->real_parent->tgid == group_leader->tgid) {
err = -EPERM;
if (process_session(p) != process_session(group_leader))
goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment