lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 24 Aug 2023 00:13:29 +0800
From:   Chen Yu <yu.c.chen@...el.com>
To:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Chenzhou Feng <chenzhoux.feng@...el.com>,
        Chen Yu <yu.c.chen@...el.com>,
        syzbot+38d04642cea49f3a3d2e@...kaller.appspotmail.com
Subject: [PATCH] PM: hibernate: Fix the exclusive get block device in test_resume mode

commit 5904de0d735b ("PM: hibernate: Do not get block device exclusively
in test_resume mode") fixes a hibernation issue under test_resume mode.
That commit is supposed to open the block device in non-exclusive mode
when in test_resume. However the code did the opposite, which is against
its description.

Fix this by really disabling exclusive mode under test_resume.

Reported-by: syzbot+38d04642cea49f3a3d2e@...kaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/000000000000761f5f0603324129@google.com/
Fixes: 5904de0d735b ("PM: hibernate: Do not get block device exclusively in test_resume mode")
Signed-off-by: Chen Yu <yu.c.chen@...el.com>
---
 kernel/power/swap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index f6ebcd00c410..c12b34dd529c 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -1518,7 +1518,7 @@ static void *swsusp_holder;
 
 int swsusp_check(bool snapshot_test)
 {
-	void *holder = snapshot_test ? &swsusp_holder : NULL;
+	void *holder = snapshot_test ? NULL : &swsusp_holder;
 	int error;
 
 	hib_resume_bdev = blkdev_get_by_dev(swsusp_resume_device, BLK_OPEN_READ,
@@ -1573,7 +1573,7 @@ void swsusp_close(bool snapshot_test)
 		return;
 	}
 
-	blkdev_put(hib_resume_bdev, snapshot_test ? &swsusp_holder : NULL);
+	blkdev_put(hib_resume_bdev, snapshot_test ? NULL : &swsusp_holder);
 }
 
 /**
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ