aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Besogonov <cyberax@amazon.com>2017-10-27 17:59:18 +0000
committerEduardo Valentin <edubezval@gmail.com>2017-11-14 08:40:52 -0800
commit4d168283882307033df4d9e632a545ff0070fb88 (patch)
treeaee2e0d992da3078a733c89d428e195ee6fde874
parentc6560ae3b403a4c32ea7997c5c0de85a897c737f (diff)
downloadlinux-backports/v4.9.y/xen/hibernation-v4.9.58.tar.gz
PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREAbackports/v4.9.y/xen/hibernation-v4.9.58
The SNAPSHOT_SET_SWAP_AREA is supposed to be used to set the hibernation offset on a running kernel to enable hibernating to a swap file. However, it doesn't actually update the swsusp_resume_block variable. As a result, the hibernation fails at the last step (after all the data is written out) in the validation of the swap signature in mark_swapfiles(). Before this patch, the command line processing was the only place where swsusp_resume_block was set. Signed-off-by: Aleksei Besogonov <cyberax@amazon.com> Reviewed-by: Eduardo Valentin <eduval@amazon.com> Reviewed-by: Munehisa Kamata <kamatam@amazon.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r--kernel/power/user.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 35310b62738886..a14e40b80c52cc 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -374,8 +374,12 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
if (swdev) {
offset = swap_area.offset;
data->swap = swap_type_of(swdev, offset, NULL);
- if (data->swap < 0)
+ if (data->swap < 0) {
error = -ENODEV;
+ } else {
+ swsusp_resume_device = swdev;
+ swsusp_resume_block = offset;
+ }
} else {
data->swap = -1;
error = -EINVAL;