]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Universal/Variable/RuntimeDxe/VariableLockRequestToLock.c
MdeModulePkg/Variable/RuntimeDxe: Restore Variable Lock Protocol behavior
authorBret Barkelew <bret.barkelew@microsoft.com>
Tue, 8 Dec 2020 18:06:56 +0000 (10:06 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 15 Dec 2020 06:26:34 +0000 (06:26 +0000)
commita18a9bde36d2ffc12df29cdced1efa1f8f9f2021
treec6db3ad59284ceb9bbd9be3c814eb2a3bc1e9208
parentbe746104d1766a8c363e74d6063144657820d688
MdeModulePkg/Variable/RuntimeDxe: Restore Variable Lock Protocol behavior

https://bugzilla.tianocore.org/show_bug.cgi?id=3111

The VariableLock shim currently fails if called twice because the
underlying Variable Policy engine returns an error if a policy is set
on an existing variable.

This breaks existing code which expect it to silently pass if a variable
is locked multiple times (because it should "be locked").

Refactor the shim to confirm that the variable is indeed locked and then
change the error to EFI_SUCCESS and generate a DEBUG_ERROR message so
the duplicate lock can be reported in a debug log and removed.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableLockRequestToLock.c