@@ -1272,6 +1272,9 @@ static int __del_timer_sync(struct timer_list *timer)
if (ret >= 0)
return ret;
+ if (READ_ONCE(timer->flags) & TIMER_IRQSAFE)
+ continue;
+
/*
* When accessing the lock, timers of base are no longer expired
* and so timer is no longer running.
@@ -1336,6 +1339,12 @@ int del_timer_sync(struct timer_list *timer)
* could lead to deadlock.
*/
WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE));
+ /*
+ * Must be able to sleep on PREEMPT_RT because of the slowpath in
+ * __del_timer_sync().
+ */
+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && !(timer->flags & TIMER_IRQSAFE))
+ might_sleep();
return __del_timer_sync(timer);
}