From patchwork Wed Aug 23 21:51:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikel Rychliski X-Patchwork-Id: 716678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28E31C3DA66 for ; Wed, 23 Aug 2023 22:11:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238539AbjHWWLW (ORCPT ); Wed, 23 Aug 2023 18:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238555AbjHWWKy (ORCPT ); Wed, 23 Aug 2023 18:10:54 -0400 X-Greylist: delayed 601 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 23 Aug 2023 15:10:51 PDT Received: from yyz.mikelr.com (yyz.mikelr.com [170.75.163.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45FF7E6E; Wed, 23 Aug 2023 15:10:51 -0700 (PDT) Received: from glidewell.ykf.mikelr.com (unknown [IPv6:2607:f2c0:e554:3f00:c018:4aba:e7e5:c2b1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by yyz.mikelr.com (Postfix) with ESMTPSA id B9B2868C18; Wed, 23 Aug 2023 17:52:50 -0400 (EDT) From: Mikel Rychliski To: Ard Biesheuvel , Ingo Molnar Cc: Mikel Rychliski , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86/efistub: Fix PCI ROM preservation in mixed mode Date: Wed, 23 Aug 2023 17:51:58 -0400 Message-Id: <20230823215159.29082-1-mikel@mikelr.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org preserve_pci_rom_image() was accessing the romsize field in efi_pci_io_protocol_t directly instead of using the efi_table_attr() helper. This prevents the ROM image from being saved correctly during a mixed mode boot. Fixes: 2c3625cb9fa2 ("efi/x86: Fold __setup_efi_pci32() and __setup_efi_pci64() into one function") Signed-off-by: Mikel Rychliski --- drivers/firmware/efi/libstub/x86-stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index e976288728e9..2fee52ed335d 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -72,7 +72,7 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom) rom->data.type = SETUP_PCI; rom->data.len = size - sizeof(struct setup_data); rom->data.next = 0; - rom->pcilen = pci->romsize; + rom->pcilen = romsize; *__rom = rom; status = efi_call_proto(pci, pci.read, EfiPciIoWidthUint16,