Commit 971c90bfa2f0b4fe52d6d9002178d547706f1343

Authored by John Stultz
1 parent 322a8b0340

alarmtimers: Avoid possible null pointer traversal

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>

Showing 1 changed file with 2 additions and 5 deletions Side-by-side Diff

kernel/time/alarmtimer.c
... ... @@ -479,11 +479,8 @@
479 479 if (!rtcdev)
480 480 return -ENOTSUPP;
481 481  
482   - /* Save old values */
483   - old_setting->it_interval =
484   - ktime_to_timespec(timr->it.alarmtimer.period);
485   - old_setting->it_value =
486   - ktime_to_timespec(timr->it.alarmtimer.node.expires);
  482 + if (old_setting)
  483 + alarm_timer_get(timr, old_setting);
487 484  
488 485 /* If the timer was already set, cancel it */
489 486 alarm_cancel(&timr->it.alarmtimer);