diff options
author | gdong1 <gdong1@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-12-22 07:33:13 +0000 |
---|---|---|
committer | gdong1 <gdong1@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-12-22 07:33:13 +0000 |
commit | 5456306fcfb457df5200671346f2187f7dfbc768 (patch) | |
tree | 0272a10ff3ef8f2d1e666efe9bb76c27d1ddcd4d /MdeModulePkg/Universal/Variable/RuntimeDxe | |
parent | d766b22843bc2304cdb834eedc486ea3f1dd3335 (diff) | |
download | edk2-platforms-5456306fcfb457df5200671346f2187f7dfbc768.tar.xz |
Fix a potential bug that SetVariable is invoked for NV variable prior to the installation of EFI_VARIABLE_WRITE_ARCH_PROTOCOL.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11190 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Variable/RuntimeDxe')
-rw-r--r-- | MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 9a2468efb0..322a778a83 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -1363,34 +1363,33 @@ UpdateVariable ( VARIABLE_STORE_HEADER *VariableStoreHeader;
UINTN CacheOffset;
- if (CacheVariable->Volatile) {
+ if ((mVariableModuleGlobal->FvbInstance == NULL) && ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0)) {
+ //
+ // The FVB protocol is not ready. Trying to update NV variable prior to the installation
+ // of EFI_VARIABLE_WRITE_ARCH_PROTOCOL.
+ //
+ return EFI_NOT_AVAILABLE_YET;
+ }
+
+ if ((CacheVariable->CurrPtr == NULL) || CacheVariable->Volatile) {
Variable = CacheVariable;
} else {
- if (mVariableModuleGlobal->FvbInstance == NULL) {
- //
- // Trying to update NV variable prior to the installation of EFI_VARIABLE_WRITE_ARCH_PROTOCOL
- //
- return EFI_NOT_AVAILABLE_YET;
- }
-
//
+ // Update/Delete existing NV variable.
// CacheVariable points to the variable in the memory copy of Flash area
// Now let Variable points to the same variable in Flash area.
//
+ ASSERT ((Attributes & EFI_VARIABLE_NON_VOLATILE) != 0);
VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase);
Variable = &NvVariable;
Variable->StartPtr = GetStartPointer (VariableStoreHeader);
Variable->EndPtr = GetEndPointer (VariableStoreHeader);
- if (CacheVariable->CurrPtr == NULL) {
- Variable->CurrPtr = NULL;
- } else {
- Variable->CurrPtr = (VARIABLE_HEADER *)((UINTN)Variable->StartPtr + ((UINTN)CacheVariable->CurrPtr - (UINTN)CacheVariable->StartPtr));
- }
- Variable->Volatile = FALSE;
- }
-
- Fvb = mVariableModuleGlobal->FvbInstance;
- Reclaimed = FALSE;
+ Variable->CurrPtr = (VARIABLE_HEADER *)((UINTN)Variable->StartPtr + ((UINTN)CacheVariable->CurrPtr - (UINTN)CacheVariable->StartPtr));
+ Variable->Volatile = FALSE;
+ }
+
+ Fvb = mVariableModuleGlobal->FvbInstance;
+ Reclaimed = FALSE;
if (Variable->CurrPtr != NULL) {
//
|