Patch "PM: sleep: Fix error handling in dpm_prepare()" has been added to the 5.10-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: sleep: Fix error handling in dpm_prepare()

to the 5.10-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-sleep-fix-error-handling-in-dpm_prepare.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 8ae44ae170b0716a7a02454405f8358cee0231bd
Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Date:   Thu Dec 16 20:30:18 2021 +0100

    PM: sleep: Fix error handling in dpm_prepare()
    
    [ Upstream commit 544e737dea5ad1a457f25dbddf68761ff25e028b ]
    
    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@xxxxxxxxx>
    Reported-by: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
    Reviewed-by: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
    Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Cc: All applicable <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index c493e48e420f..fbc57c4fcdd0 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1897,7 +1897,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);




[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