Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f1b473a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hibernation: msm: arm64: avoid swap image header corruption"

parents 446c44cf 98f28a19
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -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);