diff options
author | Star Zeng <star.zeng@intel.com> | 2013-08-16 03:19:45 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-08-16 03:19:45 +0000 |
commit | 6e67fec07f7fe4033da696eb2d08c5617edaa590 (patch) | |
tree | a88242283f04d83a5d177496bcf1884270222936 /MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | |
parent | 3d2f91ecdefae3e89c923c5a155b8acd0e645aec (diff) | |
download | edk2-platforms-6e67fec07f7fe4033da696eb2d08c5617edaa590.tar.xz |
MdeModulePkg/SecurityPkg Variable: If a preexisting variable is rewritten with different attributes, SetVariable() shall not modify the variable and shall return EFI_INVALID_PARAMETER.
Two exceptions to this rule:
1. No access attributes specified
2. The only attribute differing is EFI_VARIABLE_APPEND_WRITE
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14552 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c')
-rw-r--r-- | MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 09b8b4bd21..d31fe0c871 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -2275,9 +2275,9 @@ VariableServiceSetVariable ( }
//
- // Not support authenticated variable write yet.
+ // Not support authenticated or append variable write yet.
//
- if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) {
+ if ((Attributes & (EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_APPEND_WRITE)) != 0) {
return EFI_INVALID_PARAMETER;
}
@@ -2361,6 +2361,16 @@ VariableServiceSetVariable ( Status = EFI_WRITE_PROTECTED;
goto Done;
}
+ if (Attributes != 0 && Attributes != Variable.CurrPtr->Attributes) {
+ //
+ // If a preexisting variable is rewritten with different attributes, SetVariable() shall not
+ // modify the variable and shall return EFI_INVALID_PARAMETER. Two exceptions to this rule:
+ // 1. No access attributes specified
+ // 2. The only attribute differing is EFI_VARIABLE_APPEND_WRITE
+ //
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
}
//
|