From e3531164cc008571de1da7fc2fb9005f9d89849d Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Sat, 30 Sep 2017 19:08:41 +0200 Subject: [PATCH] MdeModulePkg/Variable/RuntimeDxe: permit MorLock deletion for passthru req The SetMorLockVariable() function sets "mMorLockPassThru" to TRUE temporarily, so that it can set the MOR Control Lock variable to well-formed values without permission checks. In the next patch, we'll need the same override for deleting the MOR Control Lock variable; hence obey "mMorLockPassThru" in the deletion branch of SetVariableCheckHandlerMorLock() as well. Cc: Eric Dong Cc: Jiewen Yao Cc: Ladi Prosek Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Jiewen Yao Tested-by: Ladi Prosek --- MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c index 534bc5c7fa..3b2d555d2e 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c @@ -169,7 +169,10 @@ SetVariableCheckHandlerMorLock ( // Basic Check // if (Attributes == 0 || DataSize == 0 || Data == NULL) { - return EFI_WRITE_PROTECTED; + // + // Permit deletion for passthru request, deny it otherwise. + // + return mMorLockPassThru ? EFI_SUCCESS : EFI_WRITE_PROTECTED; } if ((Attributes != (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)) ||