]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
PM / hibernate: Check the success of generating md5 digest before hibernation
authorChen Yu <yu.c.chen@intel.com>
Fri, 21 Sep 2018 06:26:38 +0000 (14:26 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 28 Nov 2019 04:59:27 +0000 (23:59 -0500)
BugLink: https://bugs.launchpad.net/bugs/1854216
[ Upstream commit 749fa17093ff67b31dea864531a3698b6a95c26c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/x86/power/hibernate_64.c

index 5e5fe10037518749fde00e3d4c90098e0ad44bbe..45934e95a9bb58f4c74680e19953e394c16d07fd 100644 (file)
@@ -260,9 +260,9 @@ static int get_e820_md5(struct e820_table *table, void *buf)
        return ret;
 }
 
-static void hibernation_e820_save(void *buf)
+static int hibernation_e820_save(void *buf)
 {
-       get_e820_md5(e820_table_firmware, buf);
+       return get_e820_md5(e820_table_firmware, buf);
 }
 
 static bool hibernation_e820_mismatch(void *buf)
@@ -282,8 +282,9 @@ static bool hibernation_e820_mismatch(void *buf)
        return memcmp(result, buf, MD5_DIGEST_SIZE) ? true : false;
 }
 #else
-static void hibernation_e820_save(void *buf)
+static int hibernation_e820_save(void *buf)
 {
+       return 0;
 }
 
 static bool hibernation_e820_mismatch(void *buf)
@@ -328,9 +329,7 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size)
 
        rdr->magic = RESTORE_MAGIC;
 
-       hibernation_e820_save(rdr->e820_digest);
-
-       return 0;
+       return hibernation_e820_save(rdr->e820_digest);
 }
 
 /**