diff options
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r-- | kernel/posix-timers.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index bd9c931b3659..60b262051d1d 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -460,9 +460,9 @@ sys_timer_create(const clockid_t which_clock, | |||
460 | timer_t __user * created_timer_id) | 460 | timer_t __user * created_timer_id) |
461 | { | 461 | { |
462 | int error = 0; | 462 | int error = 0; |
463 | struct k_itimer *new_timer = NULL; | 463 | struct k_itimer *new_timer; |
464 | int new_timer_id; | 464 | int new_timer_id; |
465 | struct task_struct *process = NULL; | 465 | struct task_struct *process; |
466 | unsigned long flags; | 466 | unsigned long flags; |
467 | sigevent_t event; | 467 | sigevent_t event; |
468 | int it_id_set = IT_ID_NOT_SET; | 468 | int it_id_set = IT_ID_NOT_SET; |
@@ -523,32 +523,12 @@ sys_timer_create(const clockid_t which_clock, | |||
523 | 523 | ||
524 | read_lock(&tasklist_lock); | 524 | read_lock(&tasklist_lock); |
525 | if ((process = good_sigevent(&event))) { | 525 | if ((process = good_sigevent(&event))) { |
526 | /* | 526 | get_task_struct(process); |
527 | * We may be setting up this process for another | ||
528 | * thread. It may be exiting. To catch this | ||
529 | * case the we check the PF_EXITING flag. If | ||
530 | * the flag is not set, the siglock will catch | ||
531 | * him before it is too late (in exit_itimers). | ||
532 | * | ||
533 | * The exec case is a bit more invloved but easy | ||
534 | * to code. If the process is in our thread | ||
535 | * group (and it must be or we would not allow | ||
536 | * it here) and is doing an exec, it will cause | ||
537 | * us to be killed. In this case it will wait | ||
538 | * for us to die which means we can finish this | ||
539 | * linkage with our last gasp. I.e. no code :) | ||
540 | */ | ||
541 | spin_lock_irqsave(&process->sighand->siglock, flags); | 527 | spin_lock_irqsave(&process->sighand->siglock, flags); |
542 | if (!(process->flags & PF_EXITING)) { | 528 | new_timer->it_process = process; |
543 | get_task_struct(process); | 529 | list_add(&new_timer->list, |
544 | new_timer->it_process = process; | 530 | &process->signal->posix_timers); |
545 | list_add(&new_timer->list, | 531 | spin_unlock_irqrestore(&process->sighand->siglock, flags); |
546 | &process->signal->posix_timers); | ||
547 | spin_unlock_irqrestore(&process->sighand->siglock, flags); | ||
548 | } else { | ||
549 | spin_unlock_irqrestore(&process->sighand->siglock, flags); | ||
550 | process = NULL; | ||
551 | } | ||
552 | } | 532 | } |
553 | read_unlock(&tasklist_lock); | 533 | read_unlock(&tasklist_lock); |
554 | if (!process) { | 534 | if (!process) { |