hibernation: msm: arm64: avoid swap image header corruption

Avoid swap image header corruption based on golden_image boot
argument.

Change-Id: If15408b79cf4ff1d04af9a0abb9bfac603a3e569
Signed-off-by: Venkata Rao Kakani <vkakani@codeaurora.org>
This commit is contained in:
Venkata Rao Kakani 2018-11-22 10:40:14 +05:30
parent 84da71b286
commit 98f28a19f7

View file

@ -36,6 +36,7 @@
#define HIBERNATE_SIG "S1SUSPEND"
static int goldenimage;
/*
* When reading an {un,}compressed image, we may restore pages in place,
* in which case some architectures need these pages cleaning before they
@ -1531,7 +1532,13 @@ int swsusp_check(void)
goto put;
if (!memcmp(HIBERNATE_SIG, swsusp_header->sig, 10)) {
memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
if (!goldenimage) {
pr_debug("PM: corrupt hibernate image header\n");
memcpy(swsusp_header->sig,
swsusp_header->orig_sig, 10);
} else {
pr_debug("PM: Header corruption avoided\n");
}
/* Reset swap signature now */
error = hib_submit_io(WRITE_SYNC, swsusp_resume_block,
swsusp_header, NULL);
@ -1605,3 +1612,10 @@ static int swsusp_header_init(void)
}
core_initcall(swsusp_header_init);
static int __init golden_image_setup(char *str)
{
goldenimage = 1;
return 1;
}
__setup("golden_image", golden_image_setup);