PM: sleep: Fix possible overflow in pm_system_cancel_wakeup()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 15 Jul 2019 11:03:48 +0000 (13:03 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 23 Jul 2019 07:46:27 +0000 (09:46 +0200)
commit2933954b71f10d392764f95eec0f0aa2d103054b
tree467c9d9e5377f4c4dd77b63c026bfd0e042f42d3
parent9089f16e053afc5e18feaeb9f64cc7c90d6bd687
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: 33e4f80ee69b ("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>
drivers/base/power/wakeup.c