From: John Stultz Date: Thu, 4 Aug 2011 14:25:35 +0000 (-0700) Subject: alarmtimers: Avoid possible null pointer traversal X-Git-Tag: MMI-PSA29.97-13-9~17926^2~34 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=971c90bfa2f0b4fe52d6d9002178d547706f1343;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 CC: stable@kernel.org Signed-off-by: John Stultz --- diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 59f369f98a04..1dee3f62a6a7 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -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);