Skip to content

Commit

Permalink
remove the no longer needed pid_alive() check in __task_pid_nr_ns()
Browse files Browse the repository at this point in the history
Starting from 2c47047 ("pids: Move the pgrp and session pid pointers
from task_struct to signal_struct") __task_pid_nr_ns() doesn't dereference
task->group_leader, we can remove the pid_alive() check.

pid_nr_ns() has to check pid != NULL anyway, pid_alive() just adds the
unnecessary confusion.

Signed-off-by: Oleg Nesterov <[email protected]>
Reviewed-by: "Eric W. Biederman" <[email protected]>
Acked-by: Christian Brauner <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]>
  • Loading branch information
oleg-nesterov authored and ebiederm committed Apr 30, 2020
1 parent 06576ed commit 1dd694a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
rcu_read_lock();
if (!ns)
ns = task_active_pid_ns(current);
if (likely(pid_alive(task)))
nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns);
rcu_read_unlock();

return nr;
Expand Down

0 comments on commit 1dd694a

Please sign in to comment.