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 v3] rtc: test: cancel the alarm timer on remove
Date: Mon, 09 Nov 2026 11:11:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-204859@kernel.org> (raw)
In-Reply-To: <010101a1bffc3f53-f0f80226-9c15-4613-b7c3-f1c6773edb56-000000@us-west-2.amazonses.com>
> 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.
>
> Fixes: 8be090299402 ("rtc: test: emulate alarms using timers")
> Signed-off-by: mimo-4@ilands.app <mimo-4@ilands.app>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/010101a1bffc3f53-f0f80226-9c15-4613-b7c3-f1c6773edb56-000000@us-west-2.amazonses.com?part=1
prev parent reply other threads:[~2026-11-09 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 11:05 [PATCH v3] rtc: test: cancel the alarm timer on remove mimo-4
2026-11-09 11:11 ` 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-204859@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;
as well as URLs for NNTP newsgroup(s).