mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 00:20:53 +07:00
proc: task_state: ptrace_parent() doesn't need pid_alive() check
p->ptrace != 0 means that release_task(p) was not called, so pid_alive() buys nothing and we can remove this check. Other callers already use it directly without additional checks. Note: with or without this patch ptrace_parent() can return the pointer to the freed task, this will be explained/fixed later. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Aaron Tomlin <atomlin@redhat.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com>, Cc: Sterling Alexander <stalexan@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Roland McGrath <roland@hack.frob.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b0fafc1111
commit
abdba6e9ea
@ -157,19 +157,18 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
|
|||||||
struct user_namespace *user_ns = seq_user_ns(m);
|
struct user_namespace *user_ns = seq_user_ns(m);
|
||||||
struct group_info *group_info;
|
struct group_info *group_info;
|
||||||
int g;
|
int g;
|
||||||
|
struct task_struct *tracer;
|
||||||
const struct cred *cred;
|
const struct cred *cred;
|
||||||
pid_t ppid, tpid, tgid, ngid;
|
pid_t ppid, tpid = 0, tgid, ngid;
|
||||||
unsigned int max_fds = 0;
|
unsigned int max_fds = 0;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
ppid = pid_alive(p) ?
|
ppid = pid_alive(p) ?
|
||||||
task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
|
task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
|
||||||
tpid = 0;
|
|
||||||
if (pid_alive(p)) {
|
tracer = ptrace_parent(p);
|
||||||
struct task_struct *tracer = ptrace_parent(p);
|
|
||||||
if (tracer)
|
if (tracer)
|
||||||
tpid = task_pid_nr_ns(tracer, ns);
|
tpid = task_pid_nr_ns(tracer, ns);
|
||||||
}
|
|
||||||
|
|
||||||
tgid = task_tgid_nr_ns(p, ns);
|
tgid = task_tgid_nr_ns(p, ns);
|
||||||
ngid = task_numa_group_id(p);
|
ngid = task_numa_group_id(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user