Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2480200imm; Mon, 24 Sep 2018 05:13:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV60YxiXdZwnz6vPhZgeD0TFlpPnUj5C6DdHijRSXr0Nl3Z33xOIbGUqxr5mwuzXfYJh/OI6B X-Received: by 2002:a63:4907:: with SMTP id w7-v6mr7424942pga.123.1537791193119; Mon, 24 Sep 2018 05:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537791193; cv=none; d=google.com; s=arc-20160816; b=wUXkC6CNtFPv8MnrojOsJ3omP3po2BzQ2RHud2viClsxDrmKQe2HcsaDZ/IPRlq+gr QfoPZDTP8gWvTFJyMppCGY8DSzNKt5b5owOhWx4xH68G8cr1FVHGK+B2VY8C2LmOKjxZ 9RCRkIqbLyQdHHsGdDlInmN4tI4XrS/cnRePIpl5MsTzdfPYm//u9I6NCsx/eL1Y61/7 WUgh5Kg1HPVtVEL5dp2x/bCwpUCNsV36QVFNZzPdKJ/LNzD5/ReVf3RP2xcjI2Ytrcgl w0HIEdrLWRqEGERDLlXg2Swsd7gayJ9jdBudgetHxf5v3QtiVJ2tpFEB9n9WSl39l3kJ QVrw== 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=uhBgC/q9ORfDa6eRlgbStXa3pYWfqYvBQqk/lFUtweI=; b=LipR4Kj5PnI2aiPUEcR7pK7aXwHnVvUQtCZ+nUFOf5UPhfo+t9V8bNBUHjMS/FVKm/ gXhpiO5p/fQ6Oicbzs3hIlHCl7joMAUBasYmdtcFh1upkxHb7dNSIaO2COuC9TknvD5g IXcVdEqiT8WmYf1wzjEtKWP/x+8w0VBYduadoD4t9V3gsiGn6bICvwdEasf+v+SBDhf7 ybFgYQqNuPKbfQpUGhvI6Q5aiN7MaKUe5HxaJ3jSUWLzkqCjob+HtttZig3yQFUdse2u dV8cAd84dasgu1CkUVLTf9pIjbF3blqvgxXaKUzB5ZWGvgM2TlJzA9vp+r4OZ9Kmqxuo PF9A== 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 l24-v6si12825430pgm.600.2018.09.24.05.12.57; Mon, 24 Sep 2018 05:13:13 -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 S1731081AbeIXSNs (ORCPT + 99 others); Mon, 24 Sep 2018 14:13:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54906 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730074AbeIXSNs (ORCPT ); Mon, 24 Sep 2018 14:13:48 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 86AD51082; Mon, 24 Sep 2018 12:11:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Linus Torvalds , Peter Jones , Peter Zijlstra , Thomas Gleixner , linux-efi@vger.kernel.org, Ingo Molnar , Sasha Levin Subject: [PATCH 4.9 079/111] efi/esrt: Only call efi_mem_reserve() for boot services memory Date: Mon, 24 Sep 2018 13:52:46 +0200 Message-Id: <20180924113112.744539116@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.337261320@linuxfoundation.org> References: <20180924113103.337261320@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ard Biesheuvel [ Upstream commit 61f0d55569463a1af897117ff47d202b0ccb2e24 ] The following commit: 7e1550b8f208 ("efi: Drop type and attribute checks in efi_mem_desc_lookup()") refactored the implementation of efi_mem_desc_lookup() so that the type check is moved to the callers, one of which is the x86 version of efi_arch_mem_reserve(), where we added a modified check that only takes EFI_BOOT_SERVICES_DATA regions into account. This is reasonable, since it is the only memory type that requires this, but doing so uncovered some unexpected behavior in the ESRT code, which permits the ESRT table to reside in other types of memory than what the UEFI spec mandates (i.e., EFI_BOOT_SERVICES_DATA), and unconditionally calls efi_mem_reserve() on the region in question. This may result in errors such as esrt: Reserving ESRT space from 0x000000009c810318 to 0x000000009c810350. efi: Failed to lookup EFI memory descriptor for 0x000000009c810318 when the ESRT table is not in EFI_BOOT_SERVICES_DATA memory, but we try to reserve it nonetheless. So make the call to efi_mem_reserve() conditional on the memory type. Signed-off-by: Ard Biesheuvel Cc: Linus Torvalds Cc: Peter Jones Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/esrt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -333,7 +333,8 @@ void __init efi_esrt_init(void) end = esrt_data + size; pr_info("Reserving ESRT space from %pa to %pa.\n", &esrt_data, &end); - efi_mem_reserve(esrt_data, esrt_data_size); + if (md.type == EFI_BOOT_SERVICES_DATA) + efi_mem_reserve(esrt_data, esrt_data_size); pr_debug("esrt-init: loaded.\n"); err_memunmap: