[PATCH] PM: hibernate: Preserve error status in create_image()

Lenny Szubowicz posted 1 patch 6 days, 9 hours ago
kernel/power/hibernate.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[PATCH] PM: hibernate: Preserve error status in create_image()
Posted by Lenny Szubowicz 6 days, 9 hours ago
Prevent hibernation errors that are encountered in create_image()
from being overwritten by a success from arch_resume_nosmt() on
the routine exit cleanup path.

Fixes: ec527c318036 ("x86/power: Fix 'nosmt' vs hibernation triple fault during resume")
Cc: stable@vger.kernel.org
Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
---
 kernel/power/hibernate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index af8d07bafe02..2e837a9c617b 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -324,6 +324,7 @@ __weak int arch_resume_nosmt(void)
 static int create_image(int platform_mode)
 {
 	int error;
+	int nosmt_err;
 
 	error = dpm_suspend_end(PMSG_FREEZE);
 	if (error) {
@@ -380,8 +381,11 @@ static int create_image(int platform_mode)
 	pm_sleep_enable_secondary_cpus();
 
 	/* Allow architectures to do nosmt-specific post-resume dances */
-	if (!in_suspend)
-		error = arch_resume_nosmt();
+	if (!in_suspend) {
+		nosmt_err = arch_resume_nosmt();
+		if (!error)
+			error = nosmt_err;
+	}
 
  Platform_finish:
 	platform_finish(platform_mode);
-- 
2.54.0
Re: [PATCH] PM: hibernate: Preserve error status in create_image()
Posted by Rafael J. Wysocki 6 days, 9 hours ago
On Mon, Jun 1, 2026 at 8:57 PM Lenny Szubowicz <lszubowi@redhat.com> wrote:
>
> Prevent hibernation errors that are encountered in create_image()
> from being overwritten by a success from arch_resume_nosmt() on
> the routine exit cleanup path.
>
> Fixes: ec527c318036 ("x86/power: Fix 'nosmt' vs hibernation triple fault during resume")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
> ---
>  kernel/power/hibernate.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index af8d07bafe02..2e837a9c617b 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -324,6 +324,7 @@ __weak int arch_resume_nosmt(void)
>  static int create_image(int platform_mode)
>  {
>         int error;
> +       int nosmt_err;
>
>         error = dpm_suspend_end(PMSG_FREEZE);
>         if (error) {
> @@ -380,8 +381,11 @@ static int create_image(int platform_mode)
>         pm_sleep_enable_secondary_cpus();
>
>         /* Allow architectures to do nosmt-specific post-resume dances */
> -       if (!in_suspend)
> -               error = arch_resume_nosmt();

But in the cleanup path, in_suspend is not supposed to be set.

If it is set there, then that is the bug to address.

> +       if (!in_suspend) {
> +               nosmt_err = arch_resume_nosmt();
> +               if (!error)
> +                       error = nosmt_err;
> +       }
>
>   Platform_finish:
>         platform_finish(platform_mode);
> --