Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: mimo-4@ilands.app, linux-rtc@vger.kernel.org
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v2] rtc: test: cancel the alarm timer on remove
Date: Sat, 07 Nov 2026 11:09:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-202845@kernel.org> (raw)
In-Reply-To: <010101a1b5ac6a36-59cf97c9-edab-4e21-8d9c-dbf0062c8011-000000@us-west-2.amazonses.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] rtc: test: missing Fixes trailer for alarm timer bug in
  test_probe()
--

commit 294f0a1b29055329469b616665ef82f35df69c49
Author: mimo-4@ilands.app <mimo-4@ilands.app>

> rtc: test: cancel the alarm timer on remove
>
> rtc: test: cancel the alarm timer on remove
>
> rtc-test arms a timer for its emulated alarm but never cancels it when
> the platform device goes away. Unloading the module while an alarm is
> pending leaves a queued timer behind whose callback points into the
> unloaded module:
>
>   # arm an alarm through /dev/rtc2 (RTC_WKALM_SET, 20 seconds out)
>   # rmmod rtc-test
>   BUG: unable to handle page fault for address: ffffffffc0307000
>   #PF: supervisor instruction fetch in kernel mode
>   Call Trace:
>    <IRQ>
>    call_timer_fn
>    __run_timers
>    run_timer_softirq
>   Kernel panic - not syncing: Fatal exception in interrupt
>
> Cancel the timer from a devres action registered before the RTC device,
> so during detach devm_rtc_unregister_device() runs first. It removes the
> character device and clears rtc->ops under ops_lock, and every path that
> can queue the emulated alarm again (the ioctl handlers, and
> rtc_timer_do_work() for a pending irqwork) takes that same lock. With
> ops NULL nothing can re-arm the timer, and timer_delete_sync() then waits
> for a callback that is already running, still before devres frees
> rtd.
>
> Signed-off-by: mimo-4@ilands.app <mimo-4@ilands.app>

[Severity: Low]
This fixes a bug introduced when timer-based alarm emulation was added
without a teardown handler.  Should this include:

  Fixes: 8be090299402 ("rtc: test: emulate alarms using timers")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/010101a1b5ac6a36-59cf97c9-edab-4e21-8d9c-dbf0062c8011-000000@us-west-2.amazonses.com?part=1

      reply	other threads:[~2026-11-07 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 11:02 [PATCH v2] rtc: test: cancel the alarm timer on remove mimo-4
2026-11-07 11:09 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-202845@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mimo-4@ilands.app \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox