summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei6 Xu <wei6.xu@intel.com>2024-10-21 00:07:22 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-29 16:12:36 +0000
commit8d74a37944f9c4b53d83372c4078dde40e01e6b3 (patch)
tree77f702131081f83184fbc4ddf1298bace7719744
parent334f5748869996eee994f9dee41f3e6a3d9bd087 (diff)
downloadedk2-8d74a37944f9c4b53d83372c4078dde40e01e6b3.tar.gz
StandaloneMmPkg/Core: Reset IsCommBufferValid to FALSE before MMI exits
In current implementation of MmCommunication, caller (StandaloneMmIplPei or MmCommunicationDxe) sets the IsCommBufferValid to TRUE and triggers synchronous MMI, then caller resets IsCommBufferValid to FLASE after MMI exits. If asynchronous MMI happens before caller resets the IsCommBufferValid to FALSE, StandaloneMmCore will mistakenly thought there is still a synchronous MMI and then update incorrect values into ReturnStatus and ReturnBufferSize. To fix the above issue, StandaloneMmCore should reset IsCommBufferValid to FALSE before MMI exits. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
index f38d7d7483..970a06045b 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.c
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
@@ -574,11 +574,12 @@ MmEntryPoint (
}
//
- // Update CommunicationBuffer, BufferSize and ReturnStatus
- // Communicate service finished, reset the pointer to CommBuffer to NULL
+ // Update ReturnBufferSize and ReturnStatus
+ // Communicate service finished, reset IsCommBufferValid to FALSE
//
- CommunicationStatus->ReturnBufferSize = BufferSize;
- CommunicationStatus->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
+ CommunicationStatus->IsCommBufferValid = FALSE;
+ CommunicationStatus->ReturnBufferSize = BufferSize;
+ CommunicationStatus->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
} else {
DEBUG ((DEBUG_ERROR, "Input buffer size is larger than the size of MM Communication Buffer\n"));
ASSERT (FALSE);