kernel-ark/fs/proc
Hiroshi Shimamoto ae0027869d latencytop: fix kernel panic while reading latency proc file
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: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-02-25 16:34:17 +01:00
..
array.c proc: seqfile convert proc_pid_status to properly handle pid namespaces 2008-02-08 09:22:24 -08:00
base.c latencytop: fix kernel panic while reading latency proc file 2008-02-25 16:34:17 +01:00
generic.c proc: fix ->open'less usage due to ->proc_fops flip 2008-02-08 09:22:24 -08:00
inode-alloc.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
inode.c proc: remove MODULE_LICENSE 2008-02-08 09:22:23 -08:00
internal.h d_path: Make proc_get_link() use a struct path argument 2008-02-14 21:17:08 -08:00
kcore.c aout: remove unnecessary inclusions of {asm, linux}/a.out.h 2008-02-08 09:22:30 -08:00
kmsg.c [PATCH] Make most file operations structs in fs/ const 2006-03-28 09:16:06 -08:00
Makefile [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
mmu.c fs/proc/mmu.c: headers butchery 2007-10-17 08:42:48 -07:00
nommu.c d_path: Make seq_path() use a struct path argument 2008-02-14 21:17:08 -08:00
proc_devtree.c [POWERPC] Make struct property's value a void * 2007-04-13 03:55:18 +10:00
proc_misc.c procfs: constify function pointer tables 2008-02-08 09:22:38 -08:00
proc_net.c proc: fix ->open'less usage due to ->proc_fops flip 2008-02-08 09:22:24 -08:00
proc_sysctl.c Embed a struct path into struct nameidata instead of nd->{dentry,mnt} 2008-02-14 21:13:33 -08:00
proc_tty.c procfs: constify function pointer tables 2008-02-08 09:22:38 -08:00
root.c proc: fix ->open'less usage due to ->proc_fops flip 2008-02-08 09:22:24 -08:00
task_mmu.c /proc/pid/pagemap: fix PM_SPECIAL macro 2008-02-23 17:12:13 -08:00
task_nommu.c d_path: Make proc_get_link() use a struct path argument 2008-02-14 21:17:08 -08:00
vmcore.c aout: remove unnecessary inclusions of {asm, linux}/a.out.h 2008-02-08 09:22:30 -08:00