From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: gregx.yeh@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Mon, 08 Jul 2019 20:47:11 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jul 2019 20:47:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,469,1557212400"; d="scan'208";a="167859305" Received: from chinghux-desk1.gar.corp.intel.com ([10.5.215.157]) by orsmga003.jf.intel.com with ESMTP; 08 Jul 2019 20:47:09 -0700 From: gregx.yeh@intel.com To: devel@edk2.groups.io Cc: Dandan Bi , Ray Ni , Ted Kuo Subject: [PATCH] MdeModulePkg/Setup: Check ConfigAccess protocol in case it's destroyed Date: Tue, 9 Jul 2019 11:46:54 +0800 Message-Id: <20190709034654.14896-1-gregx.yeh@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 https://bugzilla.tianocore.org/show_bug.cgi?id=1920 Check ConfigAccess protocol is available before process user input. Signed-off-by: GregX Yeh Cc: Dandan Bi Cc: Ray Ni Cc: Ted Kuo --- .../Universal/SetupBrowserDxe/Presentation.c | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index d7927725b2..7c36a6f2b7 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -20,6 +20,38 @@ UINT16 mCurFakeQestId; FORM_DISPLAY_ENGINE_FORM gDisplayFormData; BOOLEAN mFinishRetrieveCall = FALSE; +/** + Check whether the ConfigAccess protocol is available + + @parm FormSet FormSet of which the ConfigAcces protocol need to be checked. + + @retval EFI_SUCCESS The function executed successfully. + +**/ +EFI_STATUS +CheckConfigAccess( + IN FORM_BROWSER_FORMSET *FormSet + ) +{ + EFI_STATUS Status; + + Status = gBS->HandleProtocol ( + FormSet->DriverHandle, + &gEfiHiiConfigAccessProtocolGuid, + (VOID **) &FormSet->ConfigAccess + ); + if (EFI_ERROR (Status)) { + // + // Configuration Driver don't attach ConfigAccess protocol to its HII package + // list, then there will be no configuration action required. + // Or the ConfigAccess protocol has been uninstalled. + // + FormSet->ConfigAccess = NULL; + } + + return EFI_SUCCESS; +} + /** Evaluate all expressions in a Form. @@ -1686,6 +1718,8 @@ DisplayForm ( return Status; } + CheckConfigAccess(gCurrentSelection->FormSet); + Status = ProcessUserInput (&UserInput); FreeDisplayFormData(); return Status; -- 2.16.2.windows.1