aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pid.h
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-10-02 05:18:59 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:25 -0400
commit1a657f78dcc8ea7c53eaa1f2a45ea2315738c15f (patch)
treea19972027792082fed505c8d540f7d877e37c0ab /include/linux/pid.h
parent1c0d04c9e44f4a248335c33d2be7c7f7b06ff359 (diff)
[PATCH] introduce get_task_pid() to fix unsafe get_pid()
proc_pid_make_inode: ei->pid = get_pid(task_pid(task)); I think this is not safe. get_pid() can be preempted after checking "pid != NULL". Then the task exits, does detach_pid(), and RCU frees the pid. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r--include/linux/pid.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 7e39767b4c60..17b9e04d3586 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -68,6 +68,8 @@ extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type));
68extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid, 68extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid,
69 enum pid_type)); 69 enum pid_type));
70 70
71extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
72
71/* 73/*
72 * attach_pid() and detach_pid() must be called with the tasklist_lock 74 * attach_pid() and detach_pid() must be called with the tasklist_lock
73 * write-held. 75 * write-held.