[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1929036.rkDPr3nAr5@kreacher>
Date: Sat, 10 Aug 2019 13:24:04 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Linux ACPI <linux-acpi@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Zhang Rui <rui.zhang@...el.com>,
Rajneesh Bhardwaj <rajneesh.bhardwaj@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mario Limonciello <mario.limonciello@...l.com>,
Kai-Heng Feng <kai.heng.feng@...onical.com>
Subject: [PATCH] PM: suspend: Fix platform_suspend_prepare_noirq()
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
After commit ac9eafbe930a ("ACPI: PM: s2idle: Execute LPS0 _DSM
functions with suspended devices"), a NULL pointer may be dereferenced
if suspend-to-idle is attempted on a platform without "traditional"
suspend support due to invalid fall-through in
platform_suspend_prepare_noirq().
Fix that and while at it add missing braces in platform_resume_noirq().
Fixes: ac9eafbe930a ("ACPI: PM: s2idle: Execute LPS0 _DSM functions with suspended devices")
Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
Commit ac9eafbe930a is in linux-next only at this point.
---
kernel/power/suspend.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Index: linux-pm/kernel/power/suspend.c
===================================================================
--- linux-pm.orig/kernel/power/suspend.c
+++ linux-pm/kernel/power/suspend.c
@@ -253,10 +253,10 @@ static int platform_suspend_prepare_late
static int platform_suspend_prepare_noirq(suspend_state_t state)
{
- if (state == PM_SUSPEND_TO_IDLE) {
- if (s2idle_ops && s2idle_ops->prepare_late)
- return s2idle_ops->prepare_late();
- }
+ if (state == PM_SUSPEND_TO_IDLE)
+ return s2idle_ops && s2idle_ops->prepare_late ?
+ s2idle_ops->prepare_late() : 0;
+
return suspend_ops->prepare_late ? suspend_ops->prepare_late() : 0;
}
@@ -265,8 +265,9 @@ static void platform_resume_noirq(suspen
if (state == PM_SUSPEND_TO_IDLE) {
if (s2idle_ops && s2idle_ops->restore_early)
s2idle_ops->restore_early();
- } else if (suspend_ops->wake)
+ } else if (suspend_ops->wake) {
suspend_ops->wake();
+ }
}
static void platform_resume_early(suspend_state_t state)
Powered by blists - more mailing lists