Skip to content

Commit 7803516

Browse files
committed
Merge branch 'pm-sleep'
Merge hibernation-related fixes for 5.16-rc3. * pm-sleep: PM: hibernate: Fix snapshot partial write lengths PM: hibernate: use correct mode for swsusp_close()
2 parents 03c8398 + 88a5045 commit 7803516

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kernel/power/hibernate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static int load_image_and_restore(void)
693693
goto Unlock;
694694

695695
error = swsusp_read(&flags);
696-
swsusp_close(FMODE_READ);
696+
swsusp_close(FMODE_READ | FMODE_EXCL);
697697
if (!error)
698698
error = hibernation_restore(flags & SF_PLATFORM_MODE);
699699

@@ -983,7 +983,7 @@ static int software_resume(void)
983983
/* The snapshot device should not be opened while we're running */
984984
if (!hibernate_acquire()) {
985985
error = -EBUSY;
986-
swsusp_close(FMODE_READ);
986+
swsusp_close(FMODE_READ | FMODE_EXCL);
987987
goto Unlock;
988988
}
989989

@@ -1018,7 +1018,7 @@ static int software_resume(void)
10181018
pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
10191019
return error;
10201020
Close_Finish:
1021-
swsusp_close(FMODE_READ);
1021+
swsusp_close(FMODE_READ | FMODE_EXCL);
10221022
goto Finish;
10231023
}
10241024

kernel/power/user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
177177
if (res <= 0)
178178
goto unlock;
179179
} else {
180-
res = PAGE_SIZE - pg_offp;
180+
res = PAGE_SIZE;
181181
}
182182

183183
if (!data_of(data->handle)) {

0 commit comments

Comments
 (0)