summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-07-15 13:03:48 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-07-23 09:46:27 +0200
commit2933954b71f10d392764f95eec0f0aa2d103054b (patch)
tree467c9d9e5377f4c4dd77b63c026bfd0e042f42d3 /drivers/base
parentACPI: EC: Return bool from acpi_ec_dispatch_gpe() (diff)
downloadlinux-2933954b71f10d392764f95eec0f0aa2d103054b.tar.xz
linux-2933954b71f10d392764f95eec0f0aa2d103054b.zip
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/wakeup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index ee31d4f8d856..b30c45aad10f 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -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)