Skip to content

Commit

Permalink
StandaloneMmPkg/Core: Fix the failure to find uncompressed inner FV
Browse files Browse the repository at this point in the history
The MmCoreFfsFindMmDriver only checks for encapsulated compressed FVs.
When an inner FV is uncompressed, StandaloneMmCore will miss the FV and
all the MM drivers in the FV will not be dispatched.
Add checks for uncompressed inner FV to fix this issue.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
  • Loading branch information
xuweiintel authored and mergify[bot] committed Dec 19, 2023
1 parent 4a9fcab commit 3c66390
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions StandaloneMmPkg/Core/FwVol.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ MmCoreFfsFindMmDriver (
UINTN DepexSize;
UINTN Index;
EFI_COMMON_SECTION_HEADER *Section;
VOID *SectionData;
UINTN SectionDataSize;
UINT32 DstBufferSize;
VOID *ScratchBuffer;
UINT32 ScratchBufferSize;
Expand Down Expand Up @@ -115,6 +117,26 @@ MmCoreFfsFindMmDriver (
break;
}

//
// Check uncompressed firmware volumes
//
Status = FfsFindSectionData (
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
FileHeader,
&SectionData,
&SectionDataSize
);
if (!EFI_ERROR (Status)) {
if (SectionDataSize > sizeof (EFI_FIRMWARE_VOLUME_HEADER)) {
InnerFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)SectionData;
MmCoreFfsFindMmDriver (InnerFvHeader, Depth + 1);
continue;
}
}

//
// Check compressed firmware volumes
//
Status = FfsFindSection (
EFI_SECTION_GUID_DEFINED,
FileHeader,
Expand Down

0 comments on commit 3c66390

Please sign in to comment.