[SRU][jammy/linux-aws][kinetic/linux-aws][PATCH 12/20] UBUNTU: SAUCE: PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA

Gerald Yang gerald.yang at canonical.com
Wed Aug 17 08:51:41 UTC 2022

From: Aleksei Besogonov <cyberax at amazon.com>

BugLink: https://bugs.launchpad.net/bugs/1968062

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

Before this patch, the command line processing was the only place where
swsusp_resume_block was set.

Signed-off-by: Aleksei Besogonov <cyberax at amazon.com>
Signed-off-by: Munehisa Kamata <kamatam at amazon.com>
Signed-off-by: Anchal Agarwal <anchalag at amazon.com>
Reviewed-by: Munehisa Kamata <kamatam at amazon.com>
Reviewed-by: Eduardo Valentin <eduval at amazon.com>
CR: https://cr.amazon.com/r/8297650/
(cherry picked from commit af7ba9de0abd9cbf761e8c3feb5377c5ddf51a29 amazon-5.15.y/mainline)
Signed-off-by: Gerald Yang <gerald.yang at canonical.com>
Signed-off-by: Matthew Ruffell <matthew.ruffell at canonical.com>
 kernel/power/user.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/power/user.c b/kernel/power/user.c
index 740723bb3885..ba7a6431acff 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -233,6 +233,10 @@ static int snapshot_set_swap_area(struct snapshot_data *data,
 	if (data->swap < 0)
 		return swdev ? -ENODEV : -EINVAL;
 	data->dev = swdev;
+	swsusp_resume_device = swdev;
+	swsusp_resume_block = offset;
 	return 0;

More information about the kernel-team mailing list