Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / hibernate: Check the success of generating md5 digest before hibernation

Currently if get_e820_md5() fails, then it will hibernate nevertheless.
Actually the error code should be propagated to upper caller so that
the hibernation could be aware of the result and terminates the process
if md5 digest fails.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Chen Yu and committed by
Rafael J. Wysocki
749fa170 cc55f753

+5 -6
+5 -6
arch/x86/power/hibernate_64.c
··· 265 265 return ret; 266 266 } 267 267 268 - static void hibernation_e820_save(void *buf) 268 + static int hibernation_e820_save(void *buf) 269 269 { 270 - get_e820_md5(e820_table_firmware, buf); 270 + return get_e820_md5(e820_table_firmware, buf); 271 271 } 272 272 273 273 static bool hibernation_e820_mismatch(void *buf) ··· 287 287 return memcmp(result, buf, MD5_DIGEST_SIZE) ? true : false; 288 288 } 289 289 #else 290 - static void hibernation_e820_save(void *buf) 290 + static int hibernation_e820_save(void *buf) 291 291 { 292 + return 0; 292 293 } 293 294 294 295 static bool hibernation_e820_mismatch(void *buf) ··· 334 333 335 334 rdr->magic = RESTORE_MAGIC; 336 335 337 - hibernation_e820_save(rdr->e820_digest); 338 - 339 - return 0; 336 + return hibernation_e820_save(rdr->e820_digest); 340 337 } 341 338 342 339 /**