diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-08 07:21:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:41 -0500 |
commit | 8dc86af00612e5ccff3384c17575362a3f2a2ca0 (patch) | |
tree | 04ed08d10cc99d4a283c8ccac078c4ac544b7b94 /kernel | |
parent | 20a8143eaa3300a58326156eaf43e03db0fd2cb6 (diff) |
Use find_task_by_vpid in posix timers
All the functions that need to lookup a task by pid in posix timers obtain
this pid from a user space, and thus this value refers to a task in the same
namespace, as the current task lives in.
So the proper behavior is to call find_task_by_vpid() here.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/posix-cpu-timers.c | 8 | ||||
-rw-r--r-- | kernel/posix-timers.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 0b7c82ac467e..2eae91f954ca 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -20,7 +20,7 @@ static int check_clock(const clockid_t which_clock) | |||
20 | return 0; | 20 | return 0; |
21 | 21 | ||
22 | read_lock(&tasklist_lock); | 22 | read_lock(&tasklist_lock); |
23 | p = find_task_by_pid(pid); | 23 | p = find_task_by_vpid(pid); |
24 | if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ? | 24 | if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ? |
25 | same_thread_group(p, current) : thread_group_leader(p))) { | 25 | same_thread_group(p, current) : thread_group_leader(p))) { |
26 | error = -EINVAL; | 26 | error = -EINVAL; |
@@ -305,7 +305,7 @@ int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp) | |||
305 | */ | 305 | */ |
306 | struct task_struct *p; | 306 | struct task_struct *p; |
307 | rcu_read_lock(); | 307 | rcu_read_lock(); |
308 | p = find_task_by_pid(pid); | 308 | p = find_task_by_vpid(pid); |
309 | if (p) { | 309 | if (p) { |
310 | if (CPUCLOCK_PERTHREAD(which_clock)) { | 310 | if (CPUCLOCK_PERTHREAD(which_clock)) { |
311 | if (same_thread_group(p, current)) { | 311 | if (same_thread_group(p, current)) { |
@@ -354,7 +354,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer) | |||
354 | if (pid == 0) { | 354 | if (pid == 0) { |
355 | p = current; | 355 | p = current; |
356 | } else { | 356 | } else { |
357 | p = find_task_by_pid(pid); | 357 | p = find_task_by_vpid(pid); |
358 | if (p && !same_thread_group(p, current)) | 358 | if (p && !same_thread_group(p, current)) |
359 | p = NULL; | 359 | p = NULL; |
360 | } | 360 | } |
@@ -362,7 +362,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer) | |||
362 | if (pid == 0) { | 362 | if (pid == 0) { |
363 | p = current->group_leader; | 363 | p = current->group_leader; |
364 | } else { | 364 | } else { |
365 | p = find_task_by_pid(pid); | 365 | p = find_task_by_vpid(pid); |
366 | if (p && !thread_group_leader(p)) | 366 | if (p && !thread_group_leader(p)) |
367 | p = NULL; | 367 | p = NULL; |
368 | } | 368 | } |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 122d5c787fe2..ce268966007d 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -404,7 +404,7 @@ static struct task_struct * good_sigevent(sigevent_t * event) | |||
404 | struct task_struct *rtn = current->group_leader; | 404 | struct task_struct *rtn = current->group_leader; |
405 | 405 | ||
406 | if ((event->sigev_notify & SIGEV_THREAD_ID ) && | 406 | if ((event->sigev_notify & SIGEV_THREAD_ID ) && |
407 | (!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) || | 407 | (!(rtn = find_task_by_vpid(event->sigev_notify_thread_id)) || |
408 | !same_thread_group(rtn, current) || | 408 | !same_thread_group(rtn, current) || |
409 | (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)) | 409 | (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)) |
410 | return NULL; | 410 | return NULL; |