fix(core): fix pm_suspend return value in case of stabilization TIMEOUT.
What changed, and why it matters
This is a one-line bug fix in the Trezor hardware wallet's power manager for STM32U5 chips. When the device timed out while waiting for its power state to stabilize, the function was accidentally returning the wrong value (false) instead of the proper error code (PM_TIMEOUT). This could cause callers to misinterpret a timeout as success, potentially mishandling power-state transitions. It is a correctness fix rather than an obvious exploit, but in embedded firmware such misreporting can contribute to reliability or security issues.
Treat as a low-risk correctness fix. Review callers of pm_suspend() to confirm they handle PM_TIMEOUT appropriately, and include this fix in the next firmware release. No urgent security response is indicated by the diff alone.
Security signals we found
Incorrect error-code return in power-management state machine
Potential silent failure / misclassification of timeout condition
Embedded firmware reliability fix with possible security side effects
Evidence from the diff
In core/embed/sys/power_manager/stm32u5/power_manager.c, pm_suspend() calls pm_wait_to_stabilize() and checks whether status is PM_OK. On timeout, the original code returned the boolean literal false instead of the pm_status_t error code PM_TIMEOUT. Because pm_suspend() is declared to return pm_status_t, returning false (0) could be misread by callers as PM_OK or another valid status, depending on enum definitions. The patch changes the return to PM_TIMEOUT so the error is propagated correctly.
Changed components
core/embed/sys/power_manager/stm32u5/power_manager.cpm_suspend()STM32U5 power managerInspect captured patch +1 / −1
diff --git a/core/embed/sys/power_manager/stm32u5/power_manager.c b/core/embed/sys/power_manager/stm32u5/power_manager.c
index 4e601867c..64a7a880d 100644
--- a/core/embed/sys/power_manager/stm32u5/power_manager.c
+++ b/core/embed/sys/power_manager/stm32u5/power_manager.c
@@ -293,7 +293,7 @@ pm_status_t pm_suspend(wakeup_flags_t* wakeup_reason) {
pm_status_t status = pm_wait_to_stabilize(drv, PM_STABILIZATION_TIMEOUT_MS);
if (status != PM_OK) {
// timeout during state machine stabilization
- return false;
+ return PM_TIMEOUT;
}
// TODO: Handle wake-up flags
Why this scored 23/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.