time: settimeofday: Validate the values of tv from user
[pandora-kernel.git] / kernel / time / tick-broadcast.c
index fd4a7b1..c3509fb 100644 (file)
@@ -66,12 +66,17 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc)
  */
 int tick_check_broadcast_device(struct clock_event_device *dev)
 {
-       if ((tick_broadcast_device.evtdev &&
+       struct clock_event_device *cur = tick_broadcast_device.evtdev;
+
+       if ((dev->features & CLOCK_EVT_FEAT_DUMMY) ||
+           (tick_broadcast_device.evtdev &&
             tick_broadcast_device.evtdev->rating >= dev->rating) ||
             (dev->features & CLOCK_EVT_FEAT_C3STOP))
                return 0;
 
        clockevents_exchange_device(tick_broadcast_device.evtdev, dev);
+       if (cur)
+               cur->event_handler = clockevents_handle_noop;
        tick_broadcast_device.evtdev = dev;
        if (!cpumask_empty(tick_get_broadcast_mask()))
                tick_broadcast_start_periodic(dev);