X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FFaultTolerantWriteDxe%2FFaultTolerantWrite.c;fp=MdeModulePkg%2FUniversal%2FFaultTolerantWriteDxe%2FFaultTolerantWrite.c;h=7a6c377854d82240e906441a473890282734b1c7;hp=f08f280b46adf43fbd25cf5fac4b8afbb2a401eb;hb=de2d7497fd7e64f9c2647bc5f1003d5f427916db;hpb=1f70d7478699bdbcc8e54f844f55e08e904d80d6 diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c index f08f280b46..7a6c377854 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c @@ -3,7 +3,7 @@ These are the common Fault Tolerant Write (FTW) functions that are shared by DXE FTW driver and SMM FTW driver. -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -526,6 +526,11 @@ FtwWrite ( // Do not assume Spare Block and Target Block have same block size // Status = FtwEraseSpareBlock (FtwDevice); + if (EFI_ERROR (Status)) { + FreePool (MyBuffer); + FreePool (SpareBuffer); + return EFI_ABORTED; + } Ptr = MyBuffer; for (Index = 0; MyBufferSize > 0; Index += 1) { if (MyBufferSize > FtwDevice->SpareBlockSize) { @@ -585,6 +590,10 @@ FtwWrite ( // Restore spare backup buffer into spare block , if no failure happened during FtwWrite. // Status = FtwEraseSpareBlock (FtwDevice); + if (EFI_ERROR (Status)) { + FreePool (SpareBuffer); + return EFI_ABORTED; + } Ptr = SpareBuffer; for (Index = 0; Index < FtwDevice->NumberOfSpareBlock; Index += 1) { MyLength = FtwDevice->SpareBlockSize; @@ -706,7 +715,10 @@ FtwRestart ( // Erase Spare block // This is restart, no need to keep spareblock content. // - FtwEraseSpareBlock (FtwDevice); + Status = FtwEraseSpareBlock (FtwDevice); + if (EFI_ERROR (Status)) { + return EFI_ABORTED; + } DEBUG ((EFI_D_ERROR, "Ftw: Restart() success \n")); return EFI_SUCCESS;