]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelSiliconPkg IntelVTdDxe: Fix potential NULL pointer dereference
authorStar Zeng <star.zeng@intel.com>
Mon, 15 Jan 2018 02:26:07 +0000 (10:26 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 16 Jan 2018 01:01:50 +0000 (09:01 +0800)
The implementation of MdeModulePkg\Universal\Acpi\AcpiTableDxe reserves
first entry of RSDT/XSDT to FADT, the first entry value is 0 when FADT
is not installed. So the RSDT/XSDT parsing code should check the entry
value first before checking the table signature.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/DmarAcpiTable.c

index b981bcdb3aa03575df205cd8925b1a513bd65a2e..342830a01fb05135706b610c8225fac98ab5eb78 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -889,7 +889,7 @@ ScanTableInRSDT (
   EntryPtr = &Rsdt->Entry;\r
   for (Index = 0; Index < EntryCount; Index ++, EntryPtr ++) {\r
     Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(*EntryPtr));\r
-    if (Table->Signature == Signature) {\r
+    if ((Table != NULL) && (Table->Signature == Signature)) {\r
       return Table;\r
     }\r
   }\r
@@ -923,7 +923,7 @@ ScanTableInXSDT (
   for (Index = 0; Index < EntryCount; Index ++) {\r
     CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), sizeof(UINT64));\r
     Table = (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(EntryPtr));\r
-    if (Table->Signature == Signature) {\r
+    if ((Table != NULL) && (Table->Signature == Signature)) {\r
       return Table;\r
     }\r
   }\r