Commit 9372023e authored by Chen Yu's avatar Chen Yu Committed by Greg Kroah-Hartman

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

[ Upstream commit 749fa170 ]

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: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarChen Yu <yu.c.chen@intel.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ed896ddf
......@@ -266,9 +266,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)
......@@ -288,8 +288,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)
......@@ -334,9 +335,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);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment