Skip to content

Commit

Permalink
pids: sys_setpgid: use change_pid() helper
Browse files Browse the repository at this point in the history
Use change_pid() instead of detach_pid() + attach_pid() in sys_setpgid().

This way task_pgrp() is not NULL in between.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc:  "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 30, 2008
1 parent 24336ea commit 83beaf3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
goto out;

if (task_pgrp(p) != pgrp) {
detach_pid(p, PIDTYPE_PGID);
attach_pid(p, PIDTYPE_PGID, pgrp);
change_pid(p, PIDTYPE_PGID, pgrp);
set_task_pgrp(p, pid_nr(pgrp));
}

Expand Down

0 comments on commit 83beaf3

Please sign in to comment.