Skip to content

Commit

Permalink
PM: sleep: Fix possible overflow in pm_system_cancel_wakeup()
Browse files Browse the repository at this point in the history
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 <rafael.j.wysocki@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Rafael J. Wysocki committed Jul 23, 2019
1 parent 9089f16 commit 2933954
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/power/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ EXPORT_SYMBOL_GPL(pm_system_wakeup);

void pm_system_cancel_wakeup(void)
{
atomic_dec(&pm_abort_suspend);
atomic_dec_if_positive(&pm_abort_suspend);
}

void pm_wakeup_clear(bool reset)
Expand Down

0 comments on commit 2933954

Please sign in to comment.