aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-timers.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-09-22 17:42:47 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-09-24 09:45:47 -0400
commit2cd499e38ec241691e4bce50bddc8f57e4cc9bd0 (patch)
tree6d0b1d89b92014b5b5177a56c244ac37cfae54d0 /kernel/posix-timers.c
parent918fc0372831dca73039e1577bfea0c2ce49bdb6 (diff)
posix-timers: sys_timer_create: remove the buggy PF_EXITING check
sys_timer_create() return -EINVAL if the target thread has PF_EXITING. This doesn't really make sense, the sub-thread can die right after unlock. And in fact, this is just wrong. Without SIGEV_THREAD_ID good_sigevent() returns ->group_leader, and it is very possible that the leader is already dead. This is OK, we shouldn't return the error in this case. Remove this check and the comment. Note that the "process" was found under tasklist_lock, it must have ->sighand != NULL. Also, remove a couple of unneeded initializations. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: mingo@elte.hu Cc: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r--kernel/posix-timers.c34
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) {