Skip to content

Commit 2933954

Browse files
committed
PM: sleep: Fix possible overflow in pm_system_cancel_wakeup()
It is not actually guaranteed that pm_abort_suspend will be nonzero when pm_system_cancel_wakeup() is called which may lead to subtle issues, so make it use atomic_dec_if_positive() instead of atomic_dec() for the safety sake. Fixes: 33e4f80 ("ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle") Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Thomas Gleixner <[email protected]>
1 parent 9089f16 commit 2933954

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/power/wakeup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ EXPORT_SYMBOL_GPL(pm_system_wakeup);
859859

860860
void pm_system_cancel_wakeup(void)
861861
{
862-
atomic_dec(&pm_abort_suspend);
862+
atomic_dec_if_positive(&pm_abort_suspend);
863863
}
864864

865865
void pm_wakeup_clear(bool reset)

0 commit comments

Comments
 (0)