mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
MdeModulePkg/FaultTolerantWriteDxe: Add validation for FtwWorkSpaceHeader
Add validation for FtwWorkSpaceHeader within the WorkSpaceRefresh() function to address an issue where the variable store cannot recover from the FTW spare block if the variable store is erased or corrupted during an FTW write or reclaim operation. Signed-off-by: Wenbo Hou <wenbo.hou@microsoft.com>
This commit is contained in:
parent
51d273d8c3
commit
d165ebcf43
2 changed files with 8 additions and 1 deletions
|
|
@ -1300,7 +1300,10 @@ InitFtwProtocol (
|
|||
// Refresh the working space data from working block
|
||||
//
|
||||
Status = WorkSpaceRefresh (FtwDevice);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "Ftw: Init.. WorkSpaceRefresh failed: Status = %r\n", Status));
|
||||
}
|
||||
|
||||
//
|
||||
// If the working block workspace is not valid, try the spare block
|
||||
//
|
||||
|
|
|
|||
|
|
@ -286,6 +286,10 @@ WorkSpaceRefresh (
|
|||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
if (!IsValidWorkSpace (FtwDevice->FtwWorkSpaceHeader)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Refresh the FtwLastWriteHeader
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue