提交 7d8da096 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

pids: __set_special_pids: use change_pid() helper

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: NOleg 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 83beaf3c
...@@ -334,13 +334,11 @@ void __set_special_pids(struct pid *pid) ...@@ -334,13 +334,11 @@ void __set_special_pids(struct pid *pid)
pid_t nr = pid_nr(pid); pid_t nr = pid_nr(pid);
if (task_session(curr) != pid) { if (task_session(curr) != pid) {
detach_pid(curr, PIDTYPE_SID); change_pid(curr, PIDTYPE_SID, pid);
attach_pid(curr, PIDTYPE_SID, pid);
set_task_session(curr, nr); set_task_session(curr, nr);
} }
if (task_pgrp(curr) != pid) { if (task_pgrp(curr) != pid) {
detach_pid(curr, PIDTYPE_PGID); change_pid(curr, PIDTYPE_PGID, pid);
attach_pid(curr, PIDTYPE_PGID, pid);
set_task_pgrp(curr, nr); set_task_pgrp(curr, nr);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册