[PATCH v2 1/2] firmware: arm_scmi: Fix deadlock between reboot notifier and forceful work

From: Cristian Marussi

Date: Tue Nov 17 2026 - 08:26:31 EST


When an ongoing reboot is detected scmi_reboot_notifier() cancels the
scheduled pending delayed work by calling cancel_delayed_work_sync():
this is done while holding sc->state_mtx which is also taken by the
worker is trying to synchronously cancel.

Such locking, though, guarantees mutual exclusion between the conflicting
activities carried on by the two threads.

Stop synchronously waiting for the cancellation so as to avoid deadlock.

Fixes: 2c4b97fee94a ("firmware: arm_scmi: Add SCMI System Power Control driver")
Reported-by: Chengyu Liu <lui2012qwq@xxxxxxxxx>
Signed-off-by: Cristian Marussi <cristian.marussi@xxxxxxx>
---
drivers/firmware/arm_scmi/scmi_power_control.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/arm_scmi/scmi_power_control.c b/drivers/firmware/arm_scmi/scmi_power_control.c
index e791a206768c..bbccebe834c3 100644
--- a/drivers/firmware/arm_scmi/scmi_power_control.c
+++ b/drivers/firmware/arm_scmi/scmi_power_control.c
@@ -140,7 +140,7 @@ static int scmi_reboot_notifier(struct notifier_block *nb,

if (sc->state == SCMI_SYSPOWER_REBOOTING) {
dev_dbg(sc->dev, "Reboot in progress...cancel delayed work.\n");
- cancel_delayed_work_sync(&sc->forceful_work);
+ cancel_delayed_work(&sc->forceful_work);
}
mutex_unlock(&sc->state_mtx);

@@ -188,12 +188,13 @@ static void scmi_forceful_work_func(struct work_struct *work)
dwork = to_delayed_work(work);
sc = dwork_to_sconf(dwork);

- dev_dbg(sc->dev, "Graceful request timed out...forcing !\n");
mutex_lock(&sc->state_mtx);
- /* avoid deadlock by unregistering reboot notifier first */
- unregister_reboot_notifier(&sc->reboot_nb);
- if (sc->state == SCMI_SYSPOWER_IN_PROGRESS)
+ if (sc->state == SCMI_SYSPOWER_IN_PROGRESS) {
+ dev_dbg(sc->dev, "Graceful request timed out...forcing !\n");
+ /* avoid deadlock by unregistering reboot notifier first */
+ unregister_reboot_notifier(&sc->reboot_nb);
scmi_request_forceful_transition(sc);
+ }
mutex_unlock(&sc->state_mtx);
}

--
2.54.0