rtc: mxc_v2: fix clock-unprepare race with the still-live alarm IRQ
Subsystems (2)
PATCH 1/1 rtc: mxc_v2: fix clock-unprepare race with the still-live alarm IRQ
remove() unprepares the clock, but the alarm IRQ is devm-managed and only actually freed after remove() returns -- so it's still live while the clock is unprepared. If it fires in that window, mxc_rtc_interrupt() calls clk_enable() on an unprepared clock.
Free the IRQ explicitly in remove(), before touching the clock, so it can't fire during or after the unprepare.
--- drivers/rtc/rtc-mxc_v2.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-mxc_v2.c +1 -0
@@ -365,6 +365,7 @@ static void mxc_rtc_remove(struct platform_device *pdev) {struct mxc_rtc_data *pdata =platform_get_drvdata (pdev); +devm_free_irq (&pdev->dev, pdata->irq, &pdev->dev);clk_disable_unprepare (pdata->clk); }
Signature · 1 line
2.25.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
remove()unprepares the clock, but the alarm IRQ is devm-managed and only actually freed afterremove()returns -- so it's still live while the clock is unprepared. If it fires in that window,mxc_rtc_interrupt()callsclk_enable()on an unprepared clock.
Quoted 8 lines
Free the IRQ explicitly in
remove(), before touching the clock, so it can't fire during or after the unprepare.Fixes 55d5a86618d3 ("rtc: mxc_v2: Add missing clk_disable_unprepare()")Reported-by Sashiko AI review <[email protected]>Assisted-by LLMSigned-off-by Cong Nguyen <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1