Patch "PM: hibernate: Add error handling for syscore_suspend()" has been added to the 6.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PM: hibernate: Add error handling for syscore_suspend()

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pm-hibernate-add-error-handling-for-syscore_suspend.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 99d23f995e63b1d4f8fbdd5dd4707410faadecca
Author: Wentao Liang <vulab@xxxxxxxxxxx>
Date:   Sun Jan 19 22:32:05 2025 +0800

    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@xxxxxxxxxxx>
    Link: https://patch.msgid.link/20250119143205.2103-1-vulab@xxxxxxxxxxx
    [ rjw: Changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 1f87aa01ba44f..10a01af63a807 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -608,7 +608,11 @@ int hibernation_platform_enter(void)
 
 	local_irq_disable();
 	system_state = SYSTEM_SUSPEND;
-	syscore_suspend();
+
+	error = syscore_suspend();
+	if (error)
+		goto Enable_irqs;
+
 	if (pm_wakeup_pending()) {
 		error = -EAGAIN;
 		goto Power_up;
@@ -620,6 +624,7 @@ int hibernation_platform_enter(void)
 
  Power_up:
 	syscore_resume();
+ Enable_irqs:
 	system_state = SYSTEM_RUNNING;
 	local_irq_enable();
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux