]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg/SecureBootConfigDxe: Fix invalid NV data issue.
authorNickle Wang <nickle.wang@hpe.com>
Tue, 29 May 2018 12:08:25 +0000 (20:08 +0800)
committerZhang, Chao B <chao.b.zhang@intel.com>
Fri, 15 Jun 2018 15:30:35 +0000 (23:30 +0800)
Check the return value of HiiGetBrowserData() before calling HiiSetBrowserData().
HiiGetBrowserData() failed to retrieve NV data during action EFI_BROWSER_ACTION_RETRIEVE.
If NV data is invalid, stop sending it to form browser.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c

index e3066f77be37766c75bc7efdb0f7f1f34d4f890a..6123b5669779a87927076b11671eca29d6fc433b 100644 (file)
@@ -2,6 +2,7 @@
   HII Config Access protocol implementation of SecureBoot configuration module.\r
 \r
 Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -4319,6 +4320,7 @@ SecureBootCallback (
   UINTN                           NameLength;\r
   UINT16                          *FilePostFix;\r
   SECUREBOOT_CONFIG_PRIVATE_DATA  *PrivateData;\r
+  BOOLEAN                         GetBrowserDataResult;\r
 \r
   Status           = EFI_SUCCESS;\r
   SecureBootEnable = NULL;\r
@@ -4343,7 +4345,7 @@ SecureBootCallback (
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  HiiGetBrowserData (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, BufferSize, (UINT8 *) IfrNvData);\r
+  GetBrowserDataResult = HiiGetBrowserData (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, BufferSize, (UINT8 *) IfrNvData);\r
 \r
   if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r
     if (QuestionId == KEY_SECURE_BOOT_MODE) {\r
@@ -4889,7 +4891,7 @@ SecureBootCallback (
 \r
 EXIT:\r
 \r
-  if (!EFI_ERROR (Status)) {\r
+  if (!EFI_ERROR (Status) && GetBrowserDataResult) {\r
     BufferSize = sizeof (SECUREBOOT_CONFIGURATION);\r
     HiiSetBrowserData (&gSecureBootConfigFormSetGuid, mSecureBootStorageName, BufferSize, (UINT8*) IfrNvData, NULL);\r
   }\r