summaryrefslogtreecommitdiff
path: root/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-03-30 07:19:44 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-03-30 07:19:44 +0000
commit9622df63df976e2f58eadd65c3cc1c4d30767ea8 (patch)
tree7abedd69dbb6cbef386b2b29adb75c3c71c1fce8 /SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
parent0ecd7c4a02110ea6c55fc33d1581ab9a54dd152e (diff)
downloadedk2-platforms-9622df63df976e2f58eadd65c3cc1c4d30767ea8.tar.xz
If setting variable in Runtime and there has been a same GUID and name variable existed in system without RT attribute, return EFI_WRITE_PROTECTED.
Signed-off-by: lzeng14 Reviewed-by: tye git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13156 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c')
-rw-r--r--SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
index 22ded16819..4c88eb6ff6 100644
--- a/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
+++ b/SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
@@ -720,7 +720,8 @@ Reclaim (
@param[in] VariableName Name of the variable to be found
@param[in] VendorGuid Vendor GUID to be found.
- @param[in] IgnoreRtAttribute Ignore RUNTIME_ACCESS attribute when searching variable.
+ @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute
+ check at runtime when searching variable.
@param[in, out] PtrTrack Variable Track Pointer structure that contains Variable Information.
@retval EFI_SUCCESS Variable found successfully
@@ -730,7 +731,7 @@ EFI_STATUS
FindVariableEx (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
- IN BOOLEAN IgnoreRtAttribute,
+ IN BOOLEAN IgnoreRtCheck,
IN OUT VARIABLE_POINTER_TRACK *PtrTrack
)
{
@@ -749,7 +750,7 @@ FindVariableEx (
if (PtrTrack->CurrPtr->State == VAR_ADDED ||
PtrTrack->CurrPtr->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)
) {
- if (IgnoreRtAttribute || !AtRuntime () || ((PtrTrack->CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS) != 0)) {
+ if (IgnoreRtCheck || !AtRuntime () || ((PtrTrack->CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS) != 0)) {
if (VariableName[0] == 0) {
if (PtrTrack->CurrPtr->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) {
InDeletedVariable = PtrTrack->CurrPtr;
@@ -785,9 +786,9 @@ FindVariableEx (
This code finds variable in storage blocks of volatile and non-volatile storage areas.
If VariableName is an empty string, then we just return the first
qualified variable without comparing VariableName and VendorGuid.
- If IgnoreRtAttribute is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS Attribute
- when searching existing variable, only VariableName and VendorGuid are compared.
- Otherwise, variables with EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.
+ If IgnoreRtCheck is TRUE, then we ignore the EFI_VARIABLE_RUNTIME_ACCESS attribute check
+ at runtime when searching existing variable, only VariableName and VendorGuid are compared.
+ Otherwise, variables without EFI_VARIABLE_RUNTIME_ACCESS are not visible at runtime.
@param[in] VariableName Name of the variable to be found.
@param[in] VendorGuid Vendor GUID to be found.
@@ -796,7 +797,8 @@ FindVariableEx (
@param[in] Global Pointer to VARIABLE_GLOBAL structure, including
base of volatile variable storage area, base of
NV variable storage area, and a lock.
- @param[in] IgnoreRtAttribute Ignore RUNTIME_ACCESS attribute when searching variable.
+ @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCESS attribute
+ check at runtime when searching variable.
@retval EFI_INVALID_PARAMETER If VariableName is not an empty string, while
VendorGuid is NULL.
@@ -810,7 +812,7 @@ FindVariable (
IN EFI_GUID *VendorGuid,
OUT VARIABLE_POINTER_TRACK *PtrTrack,
IN VARIABLE_GLOBAL *Global,
- IN BOOLEAN IgnoreRtAttribute
+ IN BOOLEAN IgnoreRtCheck
)
{
EFI_STATUS Status;
@@ -842,7 +844,7 @@ FindVariable (
PtrTrack->EndPtr = GetEndPointer (VariableStoreHeader[Type]);
PtrTrack->Volatile = (BOOLEAN) (Type == VariableStoreTypeVolatile);
- Status = FindVariableEx (VariableName, VendorGuid, IgnoreRtAttribute, PtrTrack);
+ Status = FindVariableEx (VariableName, VendorGuid, IgnoreRtCheck, PtrTrack);
if (!EFI_ERROR (Status)) {
return Status;
}