alarmtimers: Avoid possible null pointer traversal
authorJohn Stultz <john.stultz@linaro.org>
Thu, 4 Aug 2011 14:25:35 +0000 (07:25 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 10 Aug 2011 14:09:53 +0000 (07:09 -0700)
We don't check if old_setting is non null before assigning it, so
correct this.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: stable@kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
kernel/time/alarmtimer.c

index 59f369f98a04311f5bfa49d01e706d4b12ca97c4..1dee3f62a6a7d77837a10382b6e106bc0b85f65d 100644 (file)
@@ -479,11 +479,8 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
        if (!rtcdev)
                return -ENOTSUPP;
 
-       /* Save old values */
-       old_setting->it_interval =
-                       ktime_to_timespec(timr->it.alarmtimer.period);
-       old_setting->it_value =
-                       ktime_to_timespec(timr->it.alarmtimer.node.expires);
+       if (old_setting)
+               alarm_timer_get(timr, old_setting);
 
        /* If the timer was already set, cancel it */
        alarm_cancel(&timr->it.alarmtimer);