]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/Setup: Check ConfigAccess protocol in case it's destroyed
authorGregX Yeh <devel@edk2.groups.io>
Tue, 9 Jul 2019 11:46:54 +0000 (11:46 +0000)
committerJian J Wang <jian.j.wang@intel.com>
Wed, 10 Jul 2019 01:57:52 +0000 (09:57 +0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=1920
Check ConfigAccess protocol is available before process user input.

Signed-off-by: GregX Yeh <gregx.yeh@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c

index d7927725b231cc46e65dbd7739a42baf2946b7e1..7c36a6f2b7fa351e37cb57c168251f880b8ada48 100644 (file)
@@ -20,6 +20,38 @@ UINT16             mCurFakeQestId;
 FORM_DISPLAY_ENGINE_FORM gDisplayFormData;\r
 BOOLEAN            mFinishRetrieveCall = FALSE;\r
 \r
+/**\r
+  Check whether the ConfigAccess protocol is available\r
+\r
+  @parm FormSet           FormSet of which the ConfigAcces protocol need to be checked.\r
+\r
+  @retval EFI_SUCCESS     The function executed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+CheckConfigAccess(\r
+  IN FORM_BROWSER_FORMSET  *FormSet\r
+  )\r
+{\r
+  EFI_STATUS                      Status;\r
+\r
+  Status = gBS->HandleProtocol (\r
+                  FormSet->DriverHandle,\r
+                  &gEfiHiiConfigAccessProtocolGuid,\r
+                  (VOID **) &FormSet->ConfigAccess\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // Configuration Driver don't attach ConfigAccess protocol to its HII package\r
+    // list, then there will be no configuration action required.\r
+    // Or the ConfigAccess protocol has been uninstalled.\r
+    //\r
+    FormSet->ConfigAccess = NULL;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
 /**\r
   Evaluate all expressions in a Form.\r
 \r
@@ -1686,6 +1718,8 @@ DisplayForm (
     return Status;\r
   }\r
 \r
+  CheckConfigAccess(gCurrentSelection->FormSet);\r
+\r
   Status = ProcessUserInput (&UserInput);\r
   FreeDisplayFormData();\r
   return Status;\r