summaryrefslogtreecommitdiff
path: root/fs/proc/array.c
diff options
context:
space:
mode:
authorManfred Spraul <manfred@colorfullife.com>2004-12-02 15:47:45 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-12-02 15:47:45 -0800
commit01eb4811efe377ac2311329186e61f2392dee75c (patch)
tree1f761749ea731aeb917ee25669ca2d7c90613b57 /fs/proc/array.c
parentdfecb2536027830170e587712c5a4b1ccfbd544e (diff)
[PATCH] proc_pid_status() oops fix
proc_pid_status dereferences pointers in the task structure even if the task is already dead. This is probably the reason for the oops described in http://bugme.osdl.org/show_bug.cgi?id=3812 The attached patch removes the pointer dereferences by using pid_alive() for testing that the task structure contents is still valid before dereferencing them. The task structure itself is guaranteed to be valid - we hold a reference count. Signed-Off-By: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 6db46cb190c5..f5ad3980b0ff 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -171,8 +171,8 @@ static inline char * task_state(struct task_struct *p, char *buffer)
get_task_state(p),
(p->sleep_avg/1024)*100/(1020000000/1024),
p->tgid,
- p->pid, p->pid ? p->group_leader->real_parent->tgid : 0,
- p->pid && p->ptrace ? p->parent->pid : 0,
+ p->pid, pid_alive(p) ? p->group_leader->real_parent->tgid : 0,
+ pid_alive(p) && p->ptrace ? p->parent->pid : 0,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);