summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
diff options
context:
space:
mode:
authorEdwards, Craig <Craig.Edwards@dell.com>2022-01-06 00:02:53 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-01-10 07:16:05 +0000
commit6062002bd5a394fef46243dd866860c3480d918e (patch)
tree6e5699c64f62471e416236be00eaf3a7ef1a6264 /MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
parent14a731096d388aa20c0afa9fe5af55c998082efb (diff)
downloadedk2-6062002bd5a394fef46243dd866860c3480d918e.tar.gz
edk2-6062002bd5a394fef46243dd866860c3480d918e.tar.bz2
edk2-6062002bd5a394fef46243dd866860c3480d918e.zip
MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR
Read Disk does a modification of ExtMbrStartingLba with the code MultU64x32 (ExtMbrStartingLba, BlockSize) Error detection to see if ExtMbrStartingLBA has a value of 0. This is invalid as LBA 0 = MBR. After modification, the next time ExtMbrStartingLba is in this function if ExtMbrStartingLba is set to 0 in the MBR it never passes the while/do evaluation It is multiplied by 0 by read disk , set to 0 by an invalid MBR and goes back to evaluation This condition will also cause Ws19 and WS22 to hang, however Microsoft has developed a hotfix patch that will be released in 2022 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Craig Edwards <craig.edwards@dell.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c')
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
index 0f8dc54865..531b3b45ea 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
@@ -293,6 +293,13 @@ PartitionInstallMbrChildHandles (
(Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION))
{
ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA);
+ //
+ // A value of 0 is invalid for StartingLBA
+ //
+ if (ExtMbrStartingLba == 0) {
+ break;
+ }
+
continue;
}