]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
alarmtimer: Fix argument order in alarm_timer_forward()
authorZhan Xusheng <zhanxusheng1024@gmail.com>
Mon, 23 Mar 2026 06:11:30 +0000 (14:11 +0800)
committerThomas Gleixner <tglx@kernel.org>
Tue, 24 Mar 2026 22:17:14 +0000 (23:17 +0100)
alarm_timer_forward() passes arguments to alarm_forward() in the wrong
order:

  alarm_forward(alarm, timr->it_interval, now);

However, alarm_forward() is defined as:

  u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);

and uses the second argument as the current time:

  delta = ktime_sub(now, alarm->node.expires);

Passing the interval as "now" results in incorrect delta computation,
which can lead to missed expirations or incorrect overrun accounting.

This issue has been present since the introduction of
alarm_timer_forward().

Fix this by swapping the arguments.

Fixes: e7561f1633ac ("alarmtimer: Implement forward callback")
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260323061130.29991-1-zhanxusheng@xiaomi.com
kernel/time/alarmtimer.c

index 069d93bfb0c75cf50602359504c3a4d162e057c7..b64db405ba5c71f01e59207e3a1dc8c02ea5f730 100644 (file)
@@ -540,7 +540,7 @@ static s64 alarm_timer_forward(struct k_itimer *timr, ktime_t now)
 {
        struct alarm *alarm = &timr->it.alarm.alarmtimer;
 
-       return alarm_forward(alarm, timr->it_interval, now);
+       return alarm_forward(alarm, now, timr->it_interval);
 }
 
 /**