diff options
author | Andrey Vagin <avagin@openvz.org> | 2010-05-24 15:15:33 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-05-27 16:38:15 -0400 |
commit | 45e0fffc8a7778282e6a1514a6ae3e7ae6545111 (patch) | |
tree | 0a1022d1af7372169ca2b5b269b548997e2bdd83 /kernel/posix-timers.c | |
parent | 174bd1994ec67a6e6191c4ed8e5dac17fa221b84 (diff) |
posix_timer: Fix error path in timer_create
Move CLOCK_DISPATCH(which_clock, timer_create, (new_timer)) after all
posible EFAULT erros.
*_timer_create may allocate/get resources.
(for example posix_cpu_timer_create does get_task_struct)
[ tglx: fold the remove crappy comment patch into this ]
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: <stable@kernel.org>
Reviewed-by: Stanislaw Gruszka <sgruszka@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.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 00d1fda58ab6..ad723420acc3 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -559,14 +559,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
559 | new_timer->it_id = (timer_t) new_timer_id; | 559 | new_timer->it_id = (timer_t) new_timer_id; |
560 | new_timer->it_clock = which_clock; | 560 | new_timer->it_clock = which_clock; |
561 | new_timer->it_overrun = -1; | 561 | new_timer->it_overrun = -1; |
562 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | ||
563 | if (error) | ||
564 | goto out; | ||
565 | 562 | ||
566 | /* | ||
567 | * return the timer_id now. The next step is hard to | ||
568 | * back out if there is an error. | ||
569 | */ | ||
570 | if (copy_to_user(created_timer_id, | 563 | if (copy_to_user(created_timer_id, |
571 | &new_timer_id, sizeof (new_timer_id))) { | 564 | &new_timer_id, sizeof (new_timer_id))) { |
572 | error = -EFAULT; | 565 | error = -EFAULT; |
@@ -597,6 +590,10 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
597 | new_timer->sigq->info.si_tid = new_timer->it_id; | 590 | new_timer->sigq->info.si_tid = new_timer->it_id; |
598 | new_timer->sigq->info.si_code = SI_TIMER; | 591 | new_timer->sigq->info.si_code = SI_TIMER; |
599 | 592 | ||
593 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | ||
594 | if (error) | ||
595 | goto out; | ||
596 | |||
600 | spin_lock_irq(¤t->sighand->siglock); | 597 | spin_lock_irq(¤t->sighand->siglock); |
601 | new_timer->it_signal = current->signal; | 598 | new_timer->it_signal = current->signal; |
602 | list_add(&new_timer->list, ¤t->signal->posix_timers); | 599 | list_add(&new_timer->list, ¤t->signal->posix_timers); |