Skip to content

Commit 94fb823

Browse files
ideakrafaeljw
authored andcommitted
PM / Sleep: fix recovery during resuming from hibernation
If a device's dev_pm_ops::freeze callback fails during the QUIESCE phase, we don't rollback things correctly calling the thaw and complete callbacks. This could leave some devices in a suspended state in case of an error during resuming from hibernation. Signed-off-by: Imre Deak <imre.deak@intel.com> Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 246ef76 commit 94fb823

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kernel/power/hibernate.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,14 @@ int hibernation_restore(int platform_mode)
502502
error = dpm_suspend_start(PMSG_QUIESCE);
503503
if (!error) {
504504
error = resume_target_kernel(platform_mode);
505-
dpm_resume_end(PMSG_RECOVER);
505+
/*
506+
* The above should either succeed and jump to the new kernel,
507+
* or return with an error. Otherwise things are just
508+
* undefined, so let's be paranoid.
509+
*/
510+
BUG_ON(!error);
506511
}
512+
dpm_resume_end(PMSG_RECOVER);
507513
pm_restore_gfp_mask();
508514
resume_console();
509515
pm_restore_console();

0 commit comments

Comments
 (0)