[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211227151331.848644139@linuxfoundation.org>
Date: Mon, 27 Dec 2021 16:29:45 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Thomas Hellström
<thomas.hellstrom@...ux.intel.com>,
Ulf Hansson <ulf.hansson@...aro.org>
Subject: [PATCH 5.15 010/128] PM: sleep: Fix error handling in dpm_prepare()
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
commit 544e737dea5ad1a457f25dbddf68761ff25e028b upstream.
Commit 2aa36604e824 ("PM: sleep: Avoid calling put_device() under
dpm_list_mtx") forgot to update the while () loop termination
condition to also break the loop if error is nonzero, which
causes the loop to become infinite if device_prepare() returns
an error for one device.
Add the missing !error check.
Fixes: 2aa36604e824 ("PM: sleep: Avoid calling put_device() under dpm_list_mtx")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Reported-by: Thomas Hellström <thomas.hellstrom@...ux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@...ux.intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@...aro.org>
Cc: All applicable <stable@...r.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/base/power/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1906,7 +1906,7 @@ int dpm_prepare(pm_message_t state)
device_block_probing();
mutex_lock(&dpm_list_mtx);
- while (!list_empty(&dpm_list)) {
+ while (!list_empty(&dpm_list) && !error) {
struct device *dev = to_device(dpm_list.next);
get_device(dev);
Powered by blists - more mailing lists