aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-07-03 18:08:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:08:02 -0400
commit3f4185483832ccf3d2977923db576fa689c2abce (patch)
treeb977552009147be3c15097405f58f0519d29184a /fs/exec.c
parent888ffc5923e4343a78575918ab781e85fa22d244 (diff)
fs/exec.c:de_thread(): use change_pid() rather than detach_pid/attach_pid
de_thread() can use change_pid() instead of detach + attach. This looks better and this ensures that, say, next_thread() can never see a task with ->pid == NULL. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Sergey Dyasly <dserrg@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 03b907cfd765..7619dddd5622 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -947,9 +947,8 @@ static int de_thread(struct task_struct *tsk)
947 * Note: The old leader also uses this pid until release_task 947 * Note: The old leader also uses this pid until release_task
948 * is called. Odd but simple and correct. 948 * is called. Odd but simple and correct.
949 */ 949 */
950 detach_pid(tsk, PIDTYPE_PID);
951 tsk->pid = leader->pid; 950 tsk->pid = leader->pid;
952 attach_pid(tsk, PIDTYPE_PID, task_pid(leader)); 951 change_pid(tsk, PIDTYPE_PID, task_pid(leader));
953 transfer_pid(leader, tsk, PIDTYPE_PGID); 952 transfer_pid(leader, tsk, PIDTYPE_PGID);
954 transfer_pid(leader, tsk, PIDTYPE_SID); 953 transfer_pid(leader, tsk, PIDTYPE_SID);
955 954