• H
    latencytop: fix kernel panic while reading latency proc file · ae002786
    Hiroshi Shimamoto 提交于
    Reading /proc/<pid>/latency or /proc/<pid>/task/<tid>/latency could cause
    NULL pointer dereference.
    
    In lstats_open(), get_proc_task() can return NULL, in which case the kernel
    will oops at lstats_show_proc() because m->private is NULL.
    
    When get_proc_task() returns NULL, the kernel should return -ENOENT.
    
    This can be reproduced by the following script.
    while :
    do
            date
            bash -c 'ls > ls.$$' &
            pid=$!
            cat /proc/$pid/latency &
            cat /proc/$pid/latency &
            cat /proc/$pid/latency &
            cat /proc/$pid/latency
    done
    Signed-off-by: NHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    ae002786
base.c 67.5 KB