diff options
author | Star Zeng <star.zeng@intel.com> | 2015-04-10 01:52:54 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@Edk2> | 2015-04-10 01:52:54 +0000 |
commit | 27a0a8bc0e5124d327b3ab8b16a6a4ce0822dc02 (patch) | |
tree | c41cc460c36e0dc2f66cbce29d36a4190ff1f543 /SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c | |
parent | b0121d768d7cd25aa39b2140a93740a47f6f1fa0 (diff) | |
download | edk2-platforms-27a0a8bc0e5124d327b3ab8b16a6a4ce0822dc02.tar.xz |
SecurityPkg Variable: Enhance the code logic about VariableLock
to just return EFI_SUCCESS if the variable has been in the locked list.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17140 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c')
-rw-r--r-- | SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c index ec857665fd..7ecc29b94b 100644 --- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c +++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c @@ -2839,6 +2839,8 @@ VariableLockRequestToLock ( {
VARIABLE_ENTRY *Entry;
CHAR16 *Name;
+ LIST_ENTRY *Link;
+ VARIABLE_ENTRY *LockedEntry;
if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) {
return EFI_INVALID_PARAMETER;
@@ -2857,11 +2859,23 @@ VariableLockRequestToLock ( AcquireLockOnlyAtBootTime(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
+ for ( Link = GetFirstNode (&mLockedVariableList)
+ ; !IsNull (&mLockedVariableList, Link)
+ ; Link = GetNextNode (&mLockedVariableList, Link)
+ ) {
+ LockedEntry = BASE_CR (Link, VARIABLE_ENTRY, Link);
+ Name = (CHAR16 *) ((UINTN) LockedEntry + sizeof (*LockedEntry));
+ if (CompareGuid (&LockedEntry->Guid, VendorGuid) && (StrCmp (Name, VariableName) == 0)) {
+ goto Done;
+ }
+ }
+
Name = (CHAR16 *) ((UINTN) Entry + sizeof (*Entry));
StrnCpy (Name, VariableName, StrLen (VariableName));
CopyGuid (&Entry->Guid, VendorGuid);
InsertTailList (&mLockedVariableList, &Entry->Link);
+Done:
ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
return EFI_SUCCESS;
|