Skip to content

Commit

Permalink
pids: __set_special_pids: 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
__set_special_pids().

This way task_session() 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 83beaf3 commit 7d8da09
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,11 @@ void __set_special_pids(struct pid *pid)
pid_t nr = pid_nr(pid);

if (task_session(curr) != pid) {
detach_pid(curr, PIDTYPE_SID);
attach_pid(curr, PIDTYPE_SID, pid);
change_pid(curr, PIDTYPE_SID, pid);
set_task_session(curr, nr);
}
if (task_pgrp(curr) != pid) {
detach_pid(curr, PIDTYPE_PGID);
attach_pid(curr, PIDTYPE_PGID, pid);
change_pid(curr, PIDTYPE_PGID, pid);
set_task_pgrp(curr, nr);
}
}
Expand Down

0 comments on commit 7d8da09

Please sign in to comment.