From a4c9ede55fdd3de2c9138f45c4e1ca42947ed549 Mon Sep 17 00:00:00 2001 From: klu2 Date: Mon, 5 Nov 2007 06:29:00 +0000 Subject: [PATCH] the implementation of FVB->SetAttribute() interface should check the unchanged bit in parameter at first. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4267 6f19259b-4bc3-4df7-8a09-765794883524 --- .../FvbServicesRuntimeDxe/FWBlockService.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c index 7b00fd9b3a..a95d3b400d 100644 --- a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -740,6 +740,7 @@ Returns: UINT32 OldStatus; UINT32 NewStatus; EFI_STATUS Status; + EFI_FVB_ATTRIBUTES UnchangedAttributes; // // Find the right instance of the FVB private data @@ -758,6 +759,24 @@ Returns: OldStatus = OldAttributes & EFI_FVB2_STATUS; NewStatus = *Attributes & EFI_FVB2_STATUS; + UnchangedAttributes = EFI_FVB2_READ_DISABLED_CAP | \ + EFI_FVB2_READ_ENABLED_CAP | \ + EFI_FVB2_WRITE_DISABLED_CAP | \ + EFI_FVB2_WRITE_ENABLED_CAP | \ + EFI_FVB2_LOCK_CAP | \ + EFI_FVB2_STICKY_WRITE | \ + EFI_FVB2_MEMORY_MAPPED | \ + EFI_FVB2_ERASE_POLARITY | \ + EFI_FVB2_READ_LOCK_CAP | \ + EFI_FVB2_WRITE_LOCK_CAP | \ + EFI_FVB2_ALIGNMENT; + + // + // Some attributes of FV is read only can *not* be set + // + if ((OldAttributes & UnchangedAttributes) ^ (*Attributes & UnchangedAttributes)) { + return EFI_INVALID_PARAMETER; + } // // If firmware volume is locked, no status bit can be updated // -- 2.39.2