Re: [DRAFT PATCH] rtc-cmos: use spin_lock_irqsave in cmos_interrupt
From: Sebastian Andrzej Siewior
Date: Tue Jun 03 2025 - 02:47:34 EST
On 2025-06-02 22:20:19 [+0200], Mateusz Jończyk wrote:
> cmos_interrupt() can also be called also in non-interrupt contexts, such
> as in ACPI handlers via rtc_handler(). Therefore, usage of
> spin_lock(&rtc_lock) is insecure. Use spin_lock_irqsave() / etc.
> instead.
>
> Remove the local_irq_disable() hacks in cmos_check_wkalrm() and add a
> comment so that these _irqsave / _irqrestore will not be disabled again,
> as in
This also broke PREEMPT_RT due to disable-IRQ -> spinlock_t.
> commit 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ")
>
> Untested yet.
>
> Signed-off-by: Mateusz Jończyk <mat.jonczyk@xxxxx>
> Fixes: 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Sebastian