PM: hibernate: Fix the exclusive get block device in test_resume mode
Subsystems (2)
PATCH 1/1 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.
--- kernel/power/swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/power/swap.c +2 -2
@@ -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); }/**
Signature · 1 line
2.25.1
Quoted 30 lines · Chen Yu
commit
5904de0d735b("PM: hibernate: Do not get block device exclusively intest_resumemode") fixes a hibernation issue undertest_resumemode. That commit is supposed to open the block device in non-exclusive mode when intest_resume. However the code did the opposite, which is against its description.Fix this by really disabling exclusive mode under
test_resume.Reported-by [email protected]Fixes 5904de0d735b ("PM: hibernate: Do not get block device exclusively in test_resume mode")Signed-off-by Chen Yu <[email protected]>--- kernel/power/swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/power/swap.c +1
-1@@ -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,
kernel/power/swap.c void swsusp_close(bool snapshot_test) · line 1577
Quoted 6 lines
kernel/power/swap.c +1
-1@@ -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); }
This issue was reported in an Intel internal ticket by private syzkaller on 25/May/2023.
Thanks for consideration if possible.
Best Regards,
Thanks!
Quoted 5 lines
kernel/power/swap.c +0
-0/** Signature · 1 line
2.25.1
Quoted 31 lines · Chen Yu
commit
5904de0d735b("PM: hibernate: Do not get block device exclusively intest_resumemode") fixes a hibernation issue undertest_resumemode. That commit is supposed to open the block device in non-exclusive mode when intest_resume. However the code did the opposite, which is against its description.Fix this by really disabling exclusive mode under
test_resume.Reported-by [email protected]Fixes 5904de0d735b ("PM: hibernate: Do not get block device exclusively in test_resume mode")Signed-off-by Chen Yu <[email protected]>--- kernel/power/swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/power/swap.c +1
-1@@ -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,
kernel/power/swap.c void swsusp_close(bool snapshot_test)
Quoted 9 lines
kernel/power/swap.c +1
-2@@ -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); }/** --
Applied as 6.6 material, thanks!