]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/hrtimer.c
[CVE-2009-0029] System call wrappers part 02
[karo-tx-linux.git] / kernel / hrtimer.c
index b68e98f4e4c12bb86b8a30ed0a37866b810defed..2dc30c59c5fd63560cc5485ca0075c958f5c36e5 100644 (file)
@@ -1143,9 +1143,9 @@ static void __run_hrtimer(struct hrtimer *timer)
        spin_lock(&cpu_base->lock);
 
        /*
-        * Note: We clear the CALLBACK bit after enqueue_hrtimer to avoid
-        * reprogramming of the event hardware. This happens at the end of this
-        * function anyway.
+        * Note: We clear the CALLBACK bit after enqueue_hrtimer and
+        * we do not reprogramm the event hardware. Happens either in
+        * hrtimer_start_range_ns() or in hrtimer_interrupt()
         */
        if (restart != HRTIMER_NORESTART) {
                BUG_ON(timer->state != HRTIMER_STATE_CALLBACK);
@@ -1268,7 +1268,11 @@ static void run_hrtimer_softirq(struct softirq_action *h)
        hrtimer_peek_ahead_timers();
 }
 
-#endif /* CONFIG_HIGH_RES_TIMERS */
+#else /* CONFIG_HIGH_RES_TIMERS */
+
+static inline void __hrtimer_peek_ahead_timers(void) { }
+
+#endif /* !CONFIG_HIGH_RES_TIMERS */
 
 /*
  * Called from timer softirq every jiffy, expire hrtimers:
@@ -1463,8 +1467,8 @@ out:
        return ret;
 }
 
-asmlinkage long
-sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
+SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
+               struct timespec __user *, rmtp)
 {
        struct timespec tu;
 
@@ -1514,14 +1518,12 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
                __remove_hrtimer(timer, old_base, HRTIMER_STATE_MIGRATE, 0);
                timer->base = new_base;
                /*
-                * Enqueue the timers on the new cpu, but do not reprogram 
-                * the timer as that would enable a deadlock between
-                * hrtimer_enqueue_reprogramm() running the timer and us still
-                * holding a nested base lock.
-                *
-                * Instead we tickle the hrtimer interrupt after the migration
-                * is done, which will run all expired timers and re-programm
-                * the timer device.
+                * Enqueue the timers on the new cpu. This does not
+                * reprogram the event device in case the timer
+                * expires before the earliest on this CPU, but we run
+                * hrtimer_interrupt after we migrated everything to
+                * sort out already expired timers and reprogram the
+                * event device.
                 */
                enqueue_hrtimer(timer, new_base);