From: Oleg Nesterov Date: Wed, 3 Jul 2013 22:08:25 +0000 (-0700) Subject: fs/exec.c:de_thread(): use change_pid() rather than detach_pid/attach_pid X-Git-Tag: firefly_0821_release~176^2~5786^2~49 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3f4185483832ccf3d2977923db576fa689c2abce;p=firefly-linux-kernel-4.4.55.git 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 Acked-by: "Eric W. Biederman" Cc: Michal Hocko Cc: Pavel Emelyanov Cc: Sergey Dyasly Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) * Note: The old leader also uses this pid until release_task * is called. Odd but simple and correct. */ - detach_pid(tsk, PIDTYPE_PID); tsk->pid = leader->pid; - attach_pid(tsk, PIDTYPE_PID, task_pid(leader)); + change_pid(tsk, PIDTYPE_PID, task_pid(leader)); transfer_pid(leader, tsk, PIDTYPE_PGID); transfer_pid(leader, tsk, PIDTYPE_SID);