aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2020-02-24 18:53:09 -0600
committerEric W. Biederman <ebiederm@xmission.com>2020-04-24 17:16:35 -0500
commit3147d8aaa03eac0e68742621e8f05323459aa37d (patch)
tree5bc54e45c09ee095940960592ad9cdad794f91ec /fs/proc/base.c
parentproc: modernize proc to support multiple private instances (diff)
downloadlinux-dev-3147d8aaa03eac0e68742621e8f05323459aa37d.tar.xz
linux-dev-3147d8aaa03eac0e68742621e8f05323459aa37d.zip
proc: Use PIDTYPE_TGID in next_tgid
Combine the pid_task and thes test has_group_leader_pid into a single dereference by using pid_task(PIDTYPE_TGID). This makes the code simpler and proof against needing to even think about any shenanigans that de_thread might get up to. Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index aa7b39a114c9..5a307b3bb2d1 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3359,20 +3359,8 @@ retry:
pid = find_ge_pid(iter.tgid, ns);
if (pid) {
iter.tgid = pid_nr_ns(pid, ns);
- iter.task = pid_task(pid, PIDTYPE_PID);
- /* What we to know is if the pid we have find is the
- * pid of a thread_group_leader. Testing for task
- * being a thread_group_leader is the obvious thing
- * todo but there is a window when it fails, due to
- * the pid transfer logic in de_thread.
- *
- * So we perform the straight forward test of seeing
- * if the pid we have found is the pid of a thread
- * group leader, and don't worry if the task we have
- * found doesn't happen to be a thread group leader.
- * As we don't care in the case of readdir.
- */
- if (!iter.task || !has_group_leader_pid(iter.task)) {
+ iter.task = pid_task(pid, PIDTYPE_TGID);
+ if (!iter.task) {
iter.tgid += 1;
goto retry;
}