summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/UefiBootManagerLib
diff options
context:
space:
mode:
authorGary Li <garyli@hpe.com>2016-06-03 15:21:26 +0800
committerLiming Gao <liming.gao@intel.com>2016-06-03 15:57:47 +0800
commitb34e44612246d9bb86251e8b940dd43a3ad64260 (patch)
tree22603d24c3fdea25afb9c48bf77bc04d6cf81ac2 /MdeModulePkg/Library/UefiBootManagerLib
parent5b03f1b5145dd7e4b3ac7bcdd05f03597b461989 (diff)
downloadedk2-platforms-b34e44612246d9bb86251e8b940dd43a3ad64260.tar.xz
MdeModulePkg:Prevent the BmRepairAllControllers routine in an infinite loop
Prevent the BmRepairAllControllers routine in an infinite loop Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Li <garyli@hpe.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/UefiBootManagerLib')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c11
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf3
2 files changed, 11 insertions, 3 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
index bffbedaf84..1e68cbc01f 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
@@ -1,8 +1,9 @@
/** @file
Library functions which relates with driver health.
-(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -439,6 +440,8 @@ BmRepairAllControllers (
BOOLEAN RebootRequired;
EFI_HII_HANDLE *HiiHandles;
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
+ UINT32 MaxRepairCount;
+ UINT32 RepairCount;
//
// Configure PcdDriverHealthConfigureForm to ZeroGuid to disable driver health check.
@@ -450,6 +453,9 @@ BmRepairAllControllers (
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &FormBrowser2);
ASSERT_EFI_ERROR (Status);
+ MaxRepairCount = PcdGet32 (PcdMaxRepairCount);
+ RepairCount = 0;
+
do {
RepairRequired = FALSE;
ConfigurationRequired = FALSE;
@@ -512,7 +518,8 @@ BmRepairAllControllers (
}
EfiBootManagerFreeDriverHealthInfo (DriverHealthInfo, Count);
- } while (RepairRequired || ConfigurationRequired);
+ RepairCount++;
+ } while ((RepairRequired || ConfigurationRequired) && ((MaxRepairCount == 0) || (RepairCount < MaxRepairCount)));
RebootRequired = FALSE;
ReconnectRequired = FALSE;
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index 9d62d3d2c1..078f2723db 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -6,6 +6,7 @@
# manipulation, driver health checking and etc.
#
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -117,4 +118,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfigureForm ## SOMETIMES_CONSUMES
-
+ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount ## CONSUMES