]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 21 Jan 2022 12:58:48 +0000 (20:58 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 7 Feb 2022 05:31:17 +0000 (05:31 +0000)
When setting mVirtualMap to NULL also set mVirtualMapMaxIndex to 0.
Without that RuntimeDriverConvertPointer() will go search the ZeroPage
for EFI_MEMORY_DESCRIPTOR entries.

In case mVirtualMapMaxIndex happens to be small small enough that'll go
unnoticed, the search will not find anything and EFI_NOT_FOUND will be
returned.

In case mVirtualMapMaxIndex is big enough the search will reach the end
of the ZeroPage and trigger a page fault.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
MdeModulePkg/Core/RuntimeDxe/Runtime.c

index 2a541408731db565bb63081ee51da7d090082421..de8f2bfce0f87f0426a0d35a36ede12105f00ed4 100644 (file)
@@ -365,7 +365,8 @@ RuntimeDriverSetVirtualAddressMap (
   //\r
   // mVirtualMap is only valid during SetVirtualAddressMap() call\r
   //\r
-  mVirtualMap = NULL;\r
+  mVirtualMap         = NULL;\r
+  mVirtualMapMaxIndex = 0;\r
 \r
   return EFI_SUCCESS;\r
 }\r