mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
[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>
This commit is contained in:
parent
1c0d04c9e4
commit
1a657f78dc
3 changed files with 13 additions and 2 deletions
|
@ -68,6 +68,8 @@ extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type));
|
|||
extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid,
|
||||
enum pid_type));
|
||||
|
||||
extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
|
||||
|
||||
/*
|
||||
* attach_pid() and detach_pid() must be called with the tasklist_lock
|
||||
* write-held.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue