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.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 60b262051d1d..5b761903b49a 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -463,7 +463,6 @@ sys_timer_create(const clockid_t which_clock,
463 struct k_itimer *new_timer; 463 struct k_itimer *new_timer;
464 int new_timer_id; 464 int new_timer_id;
465 struct task_struct *process; 465 struct task_struct *process;
466 unsigned long flags;
467 sigevent_t event; 466 sigevent_t event;
468 int it_id_set = IT_ID_NOT_SET; 467 int it_id_set = IT_ID_NOT_SET;
469 468
@@ -521,16 +520,11 @@ sys_timer_create(const clockid_t which_clock,
521 new_timer->it_sigev_signo = event.sigev_signo; 520 new_timer->it_sigev_signo = event.sigev_signo;
522 new_timer->it_sigev_value = event.sigev_value; 521 new_timer->it_sigev_value = event.sigev_value;
523 522
524 read_lock(&tasklist_lock); 523 rcu_read_lock();
525 if ((process = good_sigevent(&event))) { 524 process = good_sigevent(&event);
525 if (process)
526 get_task_struct(process); 526 get_task_struct(process);
527 spin_lock_irqsave(&process->sighand->siglock, flags); 527 rcu_read_unlock();
528 new_timer->it_process = process;
529 list_add(&new_timer->list,
530 &process->signal->posix_timers);
531 spin_unlock_irqrestore(&process->sighand->siglock, flags);
532 }
533 read_unlock(&tasklist_lock);
534 if (!process) { 528 if (!process) {
535 error = -EINVAL; 529 error = -EINVAL;
536 goto out; 530 goto out;
@@ -541,19 +535,18 @@ sys_timer_create(const clockid_t which_clock,
541 new_timer->it_sigev_value.sival_int = new_timer->it_id; 535 new_timer->it_sigev_value.sival_int = new_timer->it_id;
542 process = current->group_leader; 536 process = current->group_leader;
543 get_task_struct(process); 537 get_task_struct(process);
544 spin_lock_irqsave(&process->sighand->siglock, flags);
545 new_timer->it_process = process;
546 list_add(&new_timer->list, &process->signal->posix_timers);
547 spin_unlock_irqrestore(&process->sighand->siglock, flags);
548 } 538 }
549 539
540 spin_lock_irq(&current->sighand->siglock);
541 new_timer->it_process = process;
542 list_add(&new_timer->list, &current->signal->posix_timers);
543 spin_unlock_irq(&current->sighand->siglock);
550 /* 544 /*
551 * In the case of the timer belonging to another task, after 545 * In the case of the timer belonging to another task, after
552 * the task is unlocked, the timer is owned by the other task 546 * the task is unlocked, the timer is owned by the other task
553 * and may cease to exist at any time. Don't use or modify 547 * and may cease to exist at any time. Don't use or modify
554 * new_timer after the unlock call. 548 * new_timer after the unlock call.
555 */ 549 */
556
557out: 550out:
558 if (error) 551 if (error)
559 release_posix_timer(new_timer, it_id_set); 552 release_posix_timer(new_timer, it_id_set);