--- ./include/linux/sched.h.nt 2004-09-13 18:00:12.000000000 +0400 +++ ./include/linux/sched.h 2004-09-13 18:06:03.680828072 +0400 @@ -699,6 +699,12 @@ extern struct task_struct *find_task_by_ extern void set_special_pids(pid_t session, pid_t pgrp); extern void __set_special_pids(pid_t session, pid_t pgrp); +/* checks whether task is still hashed and can be accessed safely */ +static inline int pid_alive(struct task_struct *p) +{ + return p->pids[PIDTYPE_PID].nr != 0; +} + /* per-UID process charging. */ extern struct user_struct * alloc_uid(uid_t); static inline struct user_struct *get_uid(struct user_struct *u) --- ./fs/proc/array.c.nt 2004-09-13 18:00:09.178720584 +0400 +++ ./fs/proc/array.c 2004-09-13 18:00:51.861231856 +0400 @@ -356,7 +356,7 @@ static int do_task_stat(struct task_stru stime = task->signal->stime; } } - if (whole) { + if (whole && pid_alive(task)) { t = task; do { min_flt += t->min_flt; --- ./fs/proc/base.c.nt 2004-09-13 18:00:09.181720128 +0400 +++ ./fs/proc/base.c 2004-09-13 18:00:51.862231704 +0400 @@ -793,11 +793,6 @@ static struct inode_operations proc_pid_ .follow_link = proc_pid_follow_link }; -static inline int pid_alive(struct task_struct *p) -{ - return p->pids[PIDTYPE_PID].nr != 0; -} - #define NUMBUF 10 static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir)