pids: sys_setpgid: use change_pid() helper
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 30 Apr 2008 07:54:27 +0000 (00:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Apr 2008 15:29:49 +0000 (08:29 -0700)
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>
kernel/sys.c

index 47c30a20b5540a00d625235001fef5240218cd76..5d0b44cd435cf9d6032ece1ed944db714d29a92d 100644 (file)
@@ -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));
        }