summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Core/Dxe/FwVol/FwVol.c')
-rw-r--r--MdeModulePkg/Core/Dxe/FwVol/FwVol.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
index 07cbbb94d..66b767387 100644
--- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
@@ -3,7 +3,7 @@
Layers on top of Firmware Block protocol to produce a file abstraction
of FV based files.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -630,17 +630,24 @@ NotifyFwVolBlock (
FvDevice->FwVolHeader = FwVolHeader;
FvDevice->Fv.ParentHandle = Fvb->ParentHandle;
FvDevice->IsFfs3Fv = CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);
-
- //
- // Install an New FV protocol on the existing handle
- //
- Status = CoreInstallProtocolInterface (
- &Handle,
- &gEfiFirmwareVolume2ProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FvDevice->Fv
- );
- ASSERT_EFI_ERROR (Status);
+
+ if (!EFI_ERROR (FvCheck (FvDevice))) {
+ //
+ // Install an New FV protocol on the existing handle
+ //
+ Status = CoreInstallProtocolInterface (
+ &Handle,
+ &gEfiFirmwareVolume2ProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &FvDevice->Fv
+ );
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ //
+ // Free FvDevice Buffer for the corrupt FV image.
+ //
+ CoreFreePool (FvDevice);
+ }
}
}