Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp745350imm; Thu, 13 Sep 2018 07:09:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbB+zB0HeFtdzRmPD9KzXxsxNq8hW74wIrKy31qgb2mR57FkWMfaDNcMoYNWLgWCL0WSRtk X-Received: by 2002:a63:a745:: with SMTP id w5-v6mr7305979pgo.374.1536847758067; Thu, 13 Sep 2018 07:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847758; cv=none; d=google.com; s=arc-20160816; b=wgTo0J9wDQ/5UYZ5gmsS/9jCjIof2GMH/5zph3FJDrWuci2hvQ2levD1rg4LtZ7bfX tVpIoM8UUHt7BhClYkIkL3QHRbV0T0BrlTcJP3G/KJ2YTNT3/Gp+LO1UVv2/oZiNbOOn oSI36qivK4dzGWueW3rDNV2GVQShen+o/BrT3t8aAmwQ6jLHrHTWHtmT1R4oXgc81grv oa26gD2PLngMMUuylHVyILftsvrDqjD69IuGOuqw7tz3LMlQ6Evt7x1VZBM03NeOw2R9 r6zKt4a1tEpcc+ETLeE9RwRe/0sanNyAKxqT9lZGLwWYU6tJJY5nYIdgwyXNYUblcq1a AXRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=RpV3C++Cu/sGoKkL3mV0rNx1fHzECu/+BfiuC7RvWFg=; b=M99h9H1R4GRMvyxhP+sQ+FkHglRcpawTNHxyVvanFwGpFKXaU0bxgWok+nTLzFy+Pt V7xz5T8aQ4Sv8vztOodwN3vgpao3/QKpGTykZewd0kavP0+64vKP8yh4/TAfHSOrb4rt PiIZa6E+lg4eEGRXbd1SUwQeGkVsV+9Xz6sasi0IuO6EyOoXrjRdJ8dwO1hC7YBSiS14 HGzelUtnVVIxdjRgFJbY4pfMZ+DsGJeN+EWaC0ciiEsuCygF/oiOtBhRl0blbhbC8rYB 4sy75U0HDoVuMS4nA4/yRSmRH2gY1qayo61BGx8NYAmm+GDlNIrY5ZyIMHxuZi5JT3+D QVIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si4357100pgh.412.2018.09.13.07.09.01; Thu, 13 Sep 2018 07:09:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731615AbeIMTI3 (ORCPT + 99 others); Thu, 13 Sep 2018 15:08:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34718 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731472AbeIMTI2 (ORCPT ); Thu, 13 Sep 2018 15:08:28 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 93513D19; Thu, 13 Sep 2018 13:58:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Gross , Erik Schmauss , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.18 079/197] ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value Date: Thu, 13 Sep 2018 15:30:28 +0200 Message-Id: <20180913131844.685542049@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Erik Schmauss [ Upstream commit f016b19a9275089a2ab06c2144567c2ad8d5d6ad ] The value coming from acpi_hw_read() should not be used if it returns an error code, so check the status returned by it before using that value in two places in acpi_hw_register_read(). Reported-by: Mark Gross Signed-off-by: Erik Schmauss [ rjw: Changelog ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpica/hwregs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c @@ -528,13 +528,18 @@ acpi_status acpi_hw_register_read(u32 re status = acpi_hw_read(&value64, &acpi_gbl_FADT.xpm2_control_block); - value = (u32)value64; + if (ACPI_SUCCESS(status)) { + value = (u32)value64; + } break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ status = acpi_hw_read(&value64, &acpi_gbl_FADT.xpm_timer_block); - value = (u32)value64; + if (ACPI_SUCCESS(status)) { + value = (u32)value64; + } + break; case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */