]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
PM: hibernate: Add error handling for syscore_suspend()
authorWentao Liang <vulab@iscas.ac.cn>
Sun, 19 Jan 2025 14:32:05 +0000 (22:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:12 +0000 (12:50 +0100)
commitc499bd77ca2ae73f7140bb29c2557731903b0e9a
treec4a05eed1c89eb7635677144a4f489452bcca1ce
parent547ef7e8cbb98f966c8719a3e15d4e078aaa9b47
PM: hibernate: Add error handling for syscore_suspend()

[ Upstream commit e20a70c572539a486dbd91b225fa6a194a5e2122 ]

In hibernation_platform_enter(), the code did not check the
return value of syscore_suspend(), potentially leading to a
situation where syscore_resume() would be called even if
syscore_suspend() failed. This could cause unpredictable
behavior or system instability.

Modify the code sequence in question to properly handle errors returned
by syscore_suspend(). If an error occurs in the suspend path, the code
now jumps to label 'Enable_irqs' skipping the syscore_resume() call and
only enabling interrupts after setting the system state to SYSTEM_RUNNING.

Fixes: 40dc166cb5dd ("PM / Core: Introduce struct syscore_ops for core subsystems PM")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20250119143205.2103-1-vulab@iscas.ac.cn
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/power/hibernate.c