From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B69CFC432C0 for ; Fri, 22 Nov 2019 10:51:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D14220715 for ; Fri, 22 Nov 2019 10:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419896; bh=lFxxBxjXHU5mvLq0/vlgvYPguApXQkNTD64lNsNZdvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YcT1rmGWM6c9Jk84PWxrqcho6EIEFKsbxINHQX1R65EQEDvylqVb/nMNLT4y5PpeQ IEocu3Pv0NB+tKir/NaB0lECU0cwMtlkie3bWQXM/j0LWG2zfo1eYFg4UFm1L+E0Wk skeTUGcMFoX1vhtk3EGFKHv5SdjKqh4n6pym4kgo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729676AbfKVKvf (ORCPT ); Fri, 22 Nov 2019 05:51:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:34404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729978AbfKVKvc (ORCPT ); Fri, 22 Nov 2019 05:51:32 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 237D52070E; Fri, 22 Nov 2019 10:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419891; bh=lFxxBxjXHU5mvLq0/vlgvYPguApXQkNTD64lNsNZdvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wnuizhxxlxzS8fQfSk8ciiZefuBtWVG1Zqou18DB2riGy9yiIBq5kSlr2Ast3GKyx G5WjWwLPFt/YRYnpJTQgrtWLeebJyMGh51bbiaw4/ZmWJPXN0/SuTjcWg/4EI5IqSq o6urh0V3JVqAi0JR/JsDPC3ytGvFX3LqgqiLxgBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Pavel Machek , Chen Yu , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 045/122] PM / hibernate: Check the success of generating md5 digest before hibernation Date: Fri, 22 Nov 2019 11:28:18 +0100 Message-Id: <20191122100755.423093841@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100722.177052205@linuxfoundation.org> References: <20191122100722.177052205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Yu [ 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 Acked-by: Pavel Machek Signed-off-by: Chen Yu Acked-by: Thomas Gleixner Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- arch/x86/power/hibernate_64.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c index 9c80966c80bae..692a179b1ba32 100644 --- a/arch/x86/power/hibernate_64.c +++ b/arch/x86/power/hibernate_64.c @@ -250,9 +250,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) @@ -272,8 +272,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) @@ -318,9 +319,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); } /** -- 2.20.1