summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
index 9f372c1437..6925f3c6eb 100644
--- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
+++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
@@ -812,13 +812,6 @@ FindVariable (
UINTN Index;
//
- // We aquire the lock at the entry of FindVariable as GetVariable, GetNextVariableName
- // SetVariable all call FindVariable at entry point. Please move "Aquire Lock" to
- // the correct places if this assumption does not hold TRUE anymore.
- //
- AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
-
- //
// 0: Non-Volatile, 1: Volatile
//
VariableStoreHeader[0] = (VARIABLE_STORE_HEADER *) ((UINTN) Global->NonVolatileVariableBase);
@@ -906,6 +899,9 @@ EmuGetVariable (
if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {
return EFI_INVALID_PARAMETER;
}
+
+ AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
+
//
// Find existing variable
//
@@ -979,6 +975,8 @@ EmuGetNextVariableName (
return EFI_INVALID_PARAMETER;
}
+ AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
+
Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
@@ -1129,6 +1127,8 @@ EmuSetVariable (
}
}
+ AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
+
//
// Check whether the input variable is already existed
//