On Mon, Nov 10, 2014 at 11:00:26PM +0100, Oleg Nesterov wrote:
> rcu_read_lock() can not protect p->real_parent if release_task(p) was
> already called, change sched_show_task() to check pis_alive() like
> other users do.
> 
> Note: we need some helpers to cleanup the code like this. And it seems
> that that the usage of cpu_curr(cpu) in dump_cpu_task() is not safe too.
> 
> Signed-off-by: Oleg Nesterov <[email protected]>

Acked-by: Peter Zijlstra (Intel) <[email protected]>

> ---
>  kernel/sched/core.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 240157c..1ec75c9 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4572,8 +4572,10 @@ void sched_show_task(struct task_struct *p)
>  #ifdef CONFIG_DEBUG_STACK_USAGE
>       free = stack_not_used(p);
>  #endif
> +     ppid = 0;
>       rcu_read_lock();
> -     ppid = task_pid_nr(rcu_dereference(p->real_parent));
> +     if (pid_alive(p))
> +             ppid = task_pid_nr(rcu_dereference(p->real_parent));
>       rcu_read_unlock();
>       printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
>               task_pid_nr(p), ppid,
> -- 
> 1.5.5.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to