Skip to content

Commit

Permalink
alarmtimers: Avoid possible null pointer traversal
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Stultz committed Aug 10, 2011
1 parent 322a8b0 commit 971c90b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions kernel/time/alarmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 971c90b

Please sign in to comment.