aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-timers.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r--kernel/posix-timers.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 7a15afb73ed0..35b4bbfc78ff 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -241,7 +241,8 @@ static __init int init_posix_timers(void)
241 register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic); 241 register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
242 242
243 posix_timers_cache = kmem_cache_create("posix_timers_cache", 243 posix_timers_cache = kmem_cache_create("posix_timers_cache",
244 sizeof (struct k_itimer), 0, 0, NULL); 244 sizeof (struct k_itimer), 0, SLAB_PANIC,
245 NULL);
245 idr_init(&posix_timers_id); 246 idr_init(&posix_timers_id);
246 return 0; 247 return 0;
247} 248}
@@ -403,7 +404,7 @@ static struct task_struct * good_sigevent(sigevent_t * event)
403 404
404 if ((event->sigev_notify & SIGEV_THREAD_ID ) && 405 if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
405 (!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) || 406 (!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) ||
406 rtn->tgid != current->tgid || 407 !same_thread_group(rtn, current) ||
407 (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)) 408 (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
408 return NULL; 409 return NULL;
409 410
@@ -607,7 +608,7 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)
607 spin_lock(&timr->it_lock); 608 spin_lock(&timr->it_lock);
608 609
609 if ((timr->it_id != timer_id) || !(timr->it_process) || 610 if ((timr->it_id != timer_id) || !(timr->it_process) ||
610 timr->it_process->tgid != current->tgid) { 611 !same_thread_group(timr->it_process, current)) {
611 spin_unlock(&timr->it_lock); 612 spin_unlock(&timr->it_lock);
612 spin_unlock_irqrestore(&idr_lock, *flags); 613 spin_unlock_irqrestore(&idr_lock, *flags);
613 timr = NULL; 614 timr = NULL;
@@ -712,7 +713,7 @@ sys_timer_getoverrun(timer_t timer_id)
712{ 713{
713 struct k_itimer *timr; 714 struct k_itimer *timr;
714 int overrun; 715 int overrun;
715 long flags; 716 unsigned long flags;
716 717
717 timr = lock_timer(timer_id, &flags); 718 timr = lock_timer(timer_id, &flags);
718 if (!timr) 719 if (!timr)
@@ -784,7 +785,7 @@ sys_timer_settime(timer_t timer_id, int flags,
784 struct k_itimer *timr; 785 struct k_itimer *timr;
785 struct itimerspec new_spec, old_spec; 786 struct itimerspec new_spec, old_spec;
786 int error = 0; 787 int error = 0;
787 long flag; 788 unsigned long flag;
788 struct itimerspec *rtn = old_setting ? &old_spec : NULL; 789 struct itimerspec *rtn = old_setting ? &old_spec : NULL;
789 790
790 if (!new_setting) 791 if (!new_setting)
@@ -836,7 +837,7 @@ asmlinkage long
836sys_timer_delete(timer_t timer_id) 837sys_timer_delete(timer_t timer_id)
837{ 838{
838 struct k_itimer *timer; 839 struct k_itimer *timer;
839 long flags; 840 unsigned long flags;
840 841
841retry_delete: 842retry_delete:
842 timer = lock_timer(timer_id, &flags); 843 timer = lock_timer(timer_id, &flags);
@@ -980,9 +981,20 @@ sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp)
980static int common_nsleep(const clockid_t which_clock, int flags, 981static int common_nsleep(const clockid_t which_clock, int flags,
981 struct timespec *tsave, struct timespec __user *rmtp) 982 struct timespec *tsave, struct timespec __user *rmtp)
982{ 983{
983 return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ? 984 struct timespec rmt;
984 HRTIMER_MODE_ABS : HRTIMER_MODE_REL, 985 int ret;
985 which_clock); 986
987 ret = hrtimer_nanosleep(tsave, rmtp ? &rmt : NULL,
988 flags & TIMER_ABSTIME ?
989 HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
990 which_clock);
991
992 if (ret && rmtp) {
993 if (copy_to_user(rmtp, &rmt, sizeof(*rmtp)))
994 return -EFAULT;
995 }
996
997 return ret;
986} 998}
987 999
988asmlinkage long 1000asmlinkage long