From nobody Sat Nov 2 12:34:06 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1490021514082740.0953005215785; Mon, 20 Mar 2017 07:51:54 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 30D6980467; Mon, 20 Mar 2017 07:51:52 -0700 (PDT) Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B853380466 for ; Mon, 20 Mar 2017 07:51:50 -0700 (PDT) Received: by mail-wr0-x233.google.com with SMTP id u108so94077711wrb.3 for ; Mon, 20 Mar 2017 07:51:50 -0700 (PDT) Received: from localhost.localdomain ([160.167.112.48]) by smtp.gmail.com with ESMTPSA id k8sm20839236wre.19.2017.03.20.07.51.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 07:51:48 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=hngXpwzxv1UjHmU4Zn2QMyBGR0OsfTUXKNxoe0pf9r0=; b=bcHhtv6Hj2GaSqJLvChTiqb21zqh/SOjSqR8grci7MOpwpoMXeyFLyXlimIqEsnXsw QNWGp4ZCCWxsRCaZRvLLXz1YPtGpd2tbjJBf7lsqsJ/Hp9F2m9NcvHBMEqAnBMvgeIKU kvduZngpGPN3YIs+N8spBmt+LVovFHGy9plNk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hngXpwzxv1UjHmU4Zn2QMyBGR0OsfTUXKNxoe0pf9r0=; b=tu/BwUF039SfUZsXlXbYS0sEn8k+I3tAOGT+B71zOfyuHpakPmVSjaxdygnDOqSEoc xmS3pGalSGJoZg1hqe/DHJ+rKm6rCbWdskyIJJtp78dkbFPXIpAcOL2OVXr+Uj5e6DKZ wyN8ntWmikrHd4Ie9XmAmWy54fA3sNv/MAEfEN6WS6PyjIs/+uXe2KU/X6TIp5u8bL5O DT0dHtFRwkh25IDJ6deuIr5NrqKvPH3qTDiGSmvkAhV7wtXPKoiHlgGoCkuH0gtuf6o8 CUOrMht614DuDlIct90KySREbhpPiLug4sPgrwjqQJ3Vdcn7ppuaYGJh6u6Bfr0Nu903 MBOA== X-Gm-Message-State: AFeK/H2a28Tox2eIBgsKHc/OXmyoNCkx+0NQqYjn2Rx1N3kVfXHg8oRDz6e0l5CIO7AHIa0K X-Received: by 10.223.134.44 with SMTP id 41mr25873679wrv.26.1490021509103; Mon, 20 Mar 2017 07:51:49 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, star.zeng@intel.com, feng.tian@intel.com Date: Mon, 20 Mar 2017 14:51:36 +0000 Message-Id: <1490021496-10195-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Invocations of EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() may result in a crash when the value of PcdAcpiExposedTableVersions does not include EFI_ACPI_TABLE_VERSION_1_0B. The reason is that EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable() will only populate the Rsdt1/Rsdt3 pointers when EFI_ACPI_TABLE_VERSION_1_0B is set, whereas EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() will invoke PublishTables with EFI_ACPI_TABLE_VERSION_1_0B alawys set, resulting in a NULL pointer dereference of the Rsdt1/Rsdt3 pointers. So take PcdAcpiExposedTableVersions into account for UninstallAcpiTable as well. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Star Zeng --- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b= /MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 4bb848df5203..a635e1de5a7c 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -290,24 +290,27 @@ UninstallAcpiTable ( { EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance; EFI_STATUS Status; + EFI_ACPI_TABLE_VERSION Version; =20 // // Get the instance of the ACPI table protocol // AcpiTableInstance =3D EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This); =20 + Version =3D PcdGet32 (PcdAcpiExposedTableVersions); + // // Uninstall the ACPI table // Status =3D RemoveTableFromList ( AcpiTableInstance, - EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0, + Version, TableKey ); if (!EFI_ERROR (Status)) { Status =3D PublishTables ( AcpiTableInstance, - EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0 + Version ); } =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel