]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] introduce get_task_pid() to fix unsafe get_pid()
authorOleg Nesterov <oleg@tv-sign.ru>
Mon, 2 Oct 2006 09:18:59 +0000 (02:18 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 2 Oct 2006 14:57:25 +0000 (07:57 -0700)
commit05e05c37d2822be96bb9a5326d27859b67436b06
treea19972027792082fed505c8d540f7d877e37c0ab
parent19d09a8d18c43d113483d96505bcc4555c3b115a
[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>
fs/proc/base.c
include/linux/pid.h
kernel/pid.c