mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
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>
This commit is contained in:
parent
7043a90eee
commit
f859c6796f
|
@ -290,24 +290,27 @@ UninstallAcpiTable (
|
||||||
{
|
{
|
||||||
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
|
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
EFI_ACPI_TABLE_VERSION Version;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the instance of the ACPI table protocol
|
// Get the instance of the ACPI table protocol
|
||||||
//
|
//
|
||||||
AcpiTableInstance = EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This);
|
AcpiTableInstance = EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This);
|
||||||
|
|
||||||
|
Version = PcdGet32 (PcdAcpiExposedTableVersions);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Uninstall the ACPI table
|
// Uninstall the ACPI table
|
||||||
//
|
//
|
||||||
Status = RemoveTableFromList (
|
Status = RemoveTableFromList (
|
||||||
AcpiTableInstance,
|
AcpiTableInstance,
|
||||||
EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0,
|
Version,
|
||||||
TableKey
|
TableKey
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = PublishTables (
|
Status = PublishTables (
|
||||||
AcpiTableInstance,
|
AcpiTableInstance,
|
||||||
EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0
|
Version
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue