Skip to content

alarmtimer: Fix argument order in alarm_timer_forward() - #23

Open
CeRRiLLo89 wants to merge 1 commit into
crdroidandroid:16.0-raphaelfrom
CeRRiLLo89:backport-alarmtimer-16.0-raphael
Open

alarmtimer: Fix argument order in alarm_timer_forward()#23
CeRRiLLo89 wants to merge 1 commit into
crdroidandroid:16.0-raphaelfrom
CeRRiLLo89:backport-alarmtimer-16.0-raphael

Conversation

@CeRRiLLo89

@CeRRiLLo89 CeRRiLLo89 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Backport of the upstream/stable alarmtimer fix already present in the generic 16.0 branch to the Raphael-specific 16.0-raphael branch.

16.0-raphael still calls:

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

while alarm_forward() expects (alarm, now, interval).

This applies the existing crDroid commit e62c836e42a0db585fa3b337e9bbb04dde74c282 with no functional adaptation.

Current review state

  • Base: 8a36a953995212a06d0c353fe986f0f2b408762a
  • Head: 0d79961eb6ae0247d2fea0dc7947726a1ed98422
  • 1 commit
  • 1 changed file: kernel/time/alarmtimer.c
  • 1 insertion / 1 deletion

The branch was rebuilt cleanly after the upstream 16.0-raphael history changed. The patch hunk is unchanged from the previous PR head.

Validation

  • clean backport onto the current base
  • exactly 1 commit ahead of the base
  • exactly 1 changed file
  • patch hunk matches the existing generic 16.0 fix

No runtime symptom is attributed to this change; this PR is a narrow source backport only.

Previous head 86144fe4a1da0ec062268ffa77f4f55d358c08fc is preserved in the fork as backup-pr23-pre-rebuild-20260906.

commit 5d16467ae56343b9205caedf85e3a131e0914ad8 upstream.

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: e7561f1 ("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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
@CeRRiLLo89
CeRRiLLo89 force-pushed the backport-alarmtimer-16.0-raphael branch from 86144fe to 0d79961 Compare September 6, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants