summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmCore.c8
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c7
2 files changed, 10 insertions, 5 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 0a50b5b70e..e49661a006 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -245,7 +245,6 @@ SmmEntryPoint (
{
EFI_STATUS Status;
EFI_SMM_COMMUNICATE_HEADER *CommunicateHeader;
- BOOLEAN OldInSmm;
//
// Update SMST using the context
@@ -264,9 +263,8 @@ SmmEntryPoint (
}
//
- // Save current InSmm state and set InSmm state to TRUE, it will be used by SmmBase2 protocol
+ // Mark the InSmm flag as TRUE, it will be used by SmmBase2 protocol
//
- OldInSmm = gSmmCorePrivate->InSmm;
gSmmCorePrivate->InSmm = TRUE;
//
@@ -301,9 +299,9 @@ SmmEntryPoint (
}
//
- // Restore original InSmm state as we are going to leave SMM
+ // Clear the InSmm flag as we are going to leave SMM
//
- gSmmCorePrivate->InSmm = OldInSmm;
+ gSmmCorePrivate->InSmm = FALSE;
}
/**
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index c3c2afaec8..e372e7ecf1 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -398,6 +398,13 @@ SmmCommunicationCommunicate (
}
//
+ // Don't allow call SmiManage() directly when SMRAM is closed or locked.
+ //
+ if (!mSmmAccess->OpenState || mSmmAccess->LockState) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
// Save current InSmm state and set InSmm state to TRUE
//
OldInSmm = gSmmCorePrivate->InSmm;