[PATCH] alarmtimer: Preserve rearmed alarms during callback expiry

From: Avi Weiss

Date: Sun Nov 01 2026 - 11:40:13 EST


An alarm can be rearmed while its previous hrtimer callback is still
running. alarmtimer_fired() then dequeues the newly armed alarm, so
alarmtimer_suspend() no longer sees the wakeup even though the hrtimer
remains queued.

Only dequeue the alarm if the hrtimer is no longer queued.

Fixes: dae373be9fec ("alarmtimer: Use hrtimer per-alarm instead of per-base")
Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
---
kernel/time/alarmtimer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index ea5be5870e515..bf77af5e32c22 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -189,7 +189,8 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
struct alarm_base *base = &alarm_bases[alarm->type];

scoped_guard(spinlock_irqsave, &base->lock)
- alarmtimer_dequeue(base, alarm);
+ if (!hrtimer_is_queued(timer))
+ alarmtimer_dequeue(base, alarm);

if (alarm->function)
alarm->function(alarm, base->get_ktime());

base-commit: cbbddb6b08cc9900a87cccaa9b22bbe06aa4f50a
--
2.43.0