diff mbox

x86/power/64: Avoid memory corruption in 64-bit swsusp_arch_resume()

Message ID 2755592.YNNOVbNgS2@vostro.rjw.lan (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rafael J. Wysocki June 17, 2016, 11:33 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Commit 70595b479ce1 (x86/power/64: Fix crash whan the hibernation
code passes control to the image kernel) forgot to update the last
argument of memcpy() in swsusp_arch_resume() to reflect the other
changes made by it and that may lead to memory corruption if the
core_restore_code code happens to be located at the end of a page,
so fix it.

Fixes: 70595b479ce1 (x86/power/64: Fix crash whan the hibernation code passes control to the image kernel)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

Commit 70595b479ce1 is in tip and linux-next now.

---
 arch/x86/power/hibernate_64.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: linux-pm/arch/x86/power/hibernate_64.c
===================================================================
--- linux-pm.orig/arch/x86/power/hibernate_64.c
+++ linux-pm/arch/x86/power/hibernate_64.c
@@ -142,8 +142,7 @@  int swsusp_arch_resume(void)
 	relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC);
 	if (!relocated_restore_code)
 		return -ENOMEM;
-	memcpy(relocated_restore_code, &core_restore_code,
-	       &restore_registers - &core_restore_code);
+	memcpy(relocated_restore_code, &core_restore_code, PAGE_SIZE);
 
 	restore_image();
 	return 0;