]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commita33262fa95f41139271273161b20ce917873128f
tree310ccde082e6f69b4ee58a42c26c5a30e3cabea8
parent4df1bf06f0a20f3c0534a52ef5bbace430d92491
PM: sleep: Fix possible overflow in pm_system_cancel_wakeup()

BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 2933954b71f10d392764f95eec0f0aa2d103054b ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/base/power/wakeup.c