mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/DxeCapsuleLibFmp: Fix crash with VirtualAddressMap omitted
If the SetVirtualAddressMap() is not called, mIsVirtualAddrConverted is FALSE and the kernel crash occurs in IsNestedFmpCapsule() when executing gBS->LocateProtocol () in the else case. To serve the omitted SetVirtualAddressMap() call, we could just check mEsrtTable presence instead of relying on mIsVirtualAddrConverted. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
38ba4a64c5
commit
466f2f0c5f
|
@ -41,8 +41,7 @@
|
||||||
#include <Protocol/FirmwareManagementProgress.h>
|
#include <Protocol/FirmwareManagementProgress.h>
|
||||||
#include <Protocol/DevicePath.h>
|
#include <Protocol/DevicePath.h>
|
||||||
|
|
||||||
EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;
|
EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable = NULL;
|
||||||
BOOLEAN mIsVirtualAddrConverted = FALSE;
|
|
||||||
|
|
||||||
BOOLEAN mDxeCapsuleLibEndOfDxe = FALSE;
|
BOOLEAN mDxeCapsuleLibEndOfDxe = FALSE;
|
||||||
EFI_EVENT mDxeCapsuleLibEndOfDxeEvent = NULL;
|
EFI_EVENT mDxeCapsuleLibEndOfDxeEvent = NULL;
|
||||||
|
@ -1394,14 +1393,12 @@ IsNestedFmpCapsule (
|
||||||
EFI_SYSTEM_RESOURCE_ENTRY Entry;
|
EFI_SYSTEM_RESOURCE_ENTRY Entry;
|
||||||
|
|
||||||
EsrtGuidFound = FALSE;
|
EsrtGuidFound = FALSE;
|
||||||
if (mIsVirtualAddrConverted) {
|
if (mEsrtTable != NULL) {
|
||||||
if (mEsrtTable != NULL) {
|
EsrtEntry = (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1);
|
||||||
EsrtEntry = (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1);
|
for (Index = 0; Index < mEsrtTable->FwResourceCount; Index++, EsrtEntry++) {
|
||||||
for (Index = 0; Index < mEsrtTable->FwResourceCount; Index++, EsrtEntry++) {
|
if (CompareGuid (&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) {
|
||||||
if (CompareGuid (&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) {
|
EsrtGuidFound = TRUE;
|
||||||
EsrtGuidFound = TRUE;
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
|
||||||
extern EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable;
|
extern EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable;
|
||||||
extern BOOLEAN mIsVirtualAddrConverted;
|
|
||||||
EFI_EVENT mDxeRuntimeCapsuleLibVirtualAddressChangeEvent = NULL;
|
EFI_EVENT mDxeRuntimeCapsuleLibVirtualAddressChangeEvent = NULL;
|
||||||
EFI_EVENT mDxeRuntimeCapsuleLibReadyToBootEvent = NULL;
|
EFI_EVENT mDxeRuntimeCapsuleLibReadyToBootEvent = NULL;
|
||||||
|
|
||||||
|
@ -40,7 +39,6 @@ DxeCapsuleLibVirtualAddressChangeEvent (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
gRT->ConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&mEsrtTable);
|
gRT->ConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&mEsrtTable);
|
||||||
mIsVirtualAddrConverted = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue