Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

alarmtimer: Fix argument order in alarm_timer_forward()

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

authored by

Zhan Xusheng and committed by
Thomas Gleixner
5d16467a c3692998

+1 -1
+1 -1
kernel/time/alarmtimer.c
··· 540 540 { 541 541 struct alarm *alarm = &timr->it.alarm.alarmtimer; 542 542 543 - return alarm_forward(alarm, timr->it_interval, now); 543 + return alarm_forward(alarm, now, timr->it_interval); 544 544 } 545 545 546 546 /**