]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 20 Mar 2017 14:51:36 +0000 (14:51 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 21 Mar 2017 07:07:01 +0000 (07:07 +0000)
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

index a4fd9aff845d654c4c0bb748500d1883aa76af28..05340f80db0d8a0f4088dd5554d0287a392751d1 100644 (file)
@@ -290,24 +290,27 @@ UninstallAcpiTable (
 {\r
   EFI_ACPI_TABLE_INSTANCE   *AcpiTableInstance;\r
   EFI_STATUS                Status;\r
+  EFI_ACPI_TABLE_VERSION    Version;\r
 \r
   //\r
   // Get the instance of the ACPI table protocol\r
   //\r
   AcpiTableInstance = EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This);\r
 \r
+  Version = PcdGet32 (PcdAcpiExposedTableVersions);\r
+\r
   //\r
   // Uninstall the ACPI table\r
   //\r
   Status = RemoveTableFromList (\r
              AcpiTableInstance,\r
-             EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0,\r
+             Version,\r
              TableKey\r
              );\r
   if (!EFI_ERROR (Status)) {\r
     Status = PublishTables (\r
                AcpiTableInstance,\r
-               EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0\r
+               Version\r
                );\r
   }\r
 \r