]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Don't install FV protocol on the corrupt FV image.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 17 Feb 2012 05:04:49 +0000 (05:04 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 17 Feb 2012 05:04:49 +0000 (05:04 +0000)
Signed-off-by: lgao4
Reviewed-by: rsun3
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13020 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/FwVol/FwVol.c
MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
MdeModulePkg/Core/Dxe/FwVol/FwVolDriver.h

index 07cbbb94df56f33ff5b7b861b987e03dcb8a3cc2..66b767387250239611b59a4998e029427f644fac 100644 (file)
@@ -3,7 +3,7 @@
   Layers on top of Firmware Block protocol to produce a file abstraction\r
   of FV based files.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -630,17 +630,24 @@ NotifyFwVolBlock (
       FvDevice->FwVolHeader     = FwVolHeader;\r
       FvDevice->Fv.ParentHandle = Fvb->ParentHandle;\r
       FvDevice->IsFfs3Fv        = CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);\r
-\r
-      //\r
-      // Install an New FV protocol on the existing handle\r
-      //\r
-      Status = CoreInstallProtocolInterface (\r
-                  &Handle,\r
-                  &gEfiFirmwareVolume2ProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &FvDevice->Fv\r
-                  );\r
-      ASSERT_EFI_ERROR (Status);\r
+      \r
+      if (!EFI_ERROR (FvCheck (FvDevice))) {\r
+        //\r
+        // Install an New FV protocol on the existing handle\r
+        //\r
+        Status = CoreInstallProtocolInterface (\r
+                    &Handle,\r
+                    &gEfiFirmwareVolume2ProtocolGuid,\r
+                    EFI_NATIVE_INTERFACE,\r
+                    &FvDevice->Fv\r
+                    );\r
+        ASSERT_EFI_ERROR (Status);\r
+      } else {\r
+        //\r
+        // Free FvDevice Buffer for the corrupt FV image.\r
+        //\r
+        CoreFreePool (FvDevice);\r
+      }\r
     }\r
   }\r
 \r
index 4d84dbd8950b555bce1c3459c39c1a5bbf719a66..0a89e707613eee8caa488df75ccee7115d002830 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implements get/set firmware volume attributes\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -41,13 +41,6 @@ FvGetVolumeAttributes (
   FvDevice = FV_DEVICE_FROM_THIS (This);\r
   Fvb = FvDevice->Fvb;\r
 \r
-  if (FvDevice->CachedFv == NULL) {\r
-    Status = FvCheck (FvDevice);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-  }\r
-\r
   //\r
   // First get the Firmware Volume Block Attributes\r
   //\r
index a614b93d1bd9f87b55d48d1390c8d1e15620db94..31d15120eba9adb2329a3718285c188f73ee10ae 100644 (file)
@@ -2,7 +2,7 @@
   Firmware File System protocol. Layers on top of Firmware\r
   Block protocol to produce a file abstraction of FV based files.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -423,21 +423,4 @@ GetFwVolHeader (
   OUT    EFI_FIRMWARE_VOLUME_HEADER             **FwVolHeader\r
   );\r
 \r
-\r
-\r
-/**\r
-  Check if an FV is consistent and allocate cache for it.\r
-\r
-  @param  FvDevice              A pointer to the FvDevice to be checked.\r
-\r
-  @retval EFI_OUT_OF_RESOURCES  No enough buffer could be allocated.\r
-  @retval EFI_SUCCESS           FV is consistent and cache is allocated.\r
-  @retval EFI_VOLUME_CORRUPTED  File system is corrupted.\r
-\r
-**/\r
-EFI_STATUS\r
-FvCheck (\r
-  IN OUT FV_DEVICE  *FvDevice\r
-  );\r
-\r
 #endif\r