Patch "PM: hibernate: use correct mode for swsusp_close()" has been added to the 4.9-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: use correct mode for swsusp_close()

to the 4.9-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-use-correct-mode-for-swsusp_close.patch
and it can be found in the queue-4.9 subdirectory.

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



commit 328c7c48d19bd61465d5f64ddb1780a34fe2a5d8
Author: Thomas Zeitlhofer <thomas.zeitlhofer+lkml@xxxxxxxx>
Date:   Tue Nov 23 20:18:43 2021 +0100

    PM: hibernate: use correct mode for swsusp_close()
    
    [ Upstream commit cefcf24b4d351daf70ecd945324e200d3736821e ]
    
    Commit 39fbef4b0f77 ("PM: hibernate: Get block device exclusively in
    swsusp_check()") changed the opening mode of the block device to
    (FMODE_READ | FMODE_EXCL).
    
    In the corresponding calls to swsusp_close(), the mode is still just
    FMODE_READ which triggers the warning in blkdev_flush_mapping() on
    resume from hibernate.
    
    So, use the mode (FMODE_READ | FMODE_EXCL) also when closing the
    device.
    
    Fixes: 39fbef4b0f77 ("PM: hibernate: Get block device exclusively in swsusp_check()")
    Signed-off-by: Thomas Zeitlhofer <thomas.zeitlhofer+lkml@xxxxxxxx>
    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 7b393faf930f8..e938fd8db056b 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -672,7 +672,7 @@ static int load_image_and_restore(void)
 		goto Unlock;
 
 	error = swsusp_read(&flags);
-	swsusp_close(FMODE_READ);
+	swsusp_close(FMODE_READ | FMODE_EXCL);
 	if (!error)
 		hibernation_restore(flags & SF_PLATFORM_MODE);
 
@@ -866,7 +866,7 @@ static int software_resume(void)
 	/* The snapshot device should not be opened while we're running */
 	if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
 		error = -EBUSY;
-		swsusp_close(FMODE_READ);
+		swsusp_close(FMODE_READ | FMODE_EXCL);
 		goto Unlock;
 	}
 
@@ -900,7 +900,7 @@ static int software_resume(void)
 	pr_debug("PM: Hibernation image not present or could not be loaded.\n");
 	return error;
  Close_Finish:
-	swsusp_close(FMODE_READ);
+	swsusp_close(FMODE_READ | FMODE_EXCL);
 	goto Finish;
 }
 



[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