• Thomas Gleixner's avatar
    rtc: Fix hrtimer deadlock · 3c8bb90e
    Thomas Gleixner authored
    Ben reported a lockup related to rtc. The lockup happens due to:
    
    CPU0                                        CPU1
    
    rtc_irq_set_state()			    __run_hrtimer()
      spin_lock_irqsave(&rtc->irq_task_lock)    rtc_handle_legacy_irq();
    					      spin_lock(&rtc->irq_task_lock);
      hrtimer_cancel()
        while (callback_running);
    
    So the running callback never finishes as it's blocked on
    rtc->irq_task_lock.
    
    Use hrtimer_try_to_cancel() instead and drop rtc->irq_task_lock while
    waiting for the callback. Fix this for both rtc_irq_set_state() and
    rtc_irq_set_freq().
    
    Cc: stable@kernel.org
    Reported-by: default avatarBen Greear <greearb@candelatech.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    3c8bb90e
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt/kvm Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
REPORTING-BUGS Loading commit data...