Blame SOURCES/0009-MokManager-Stop-using-EFI_VARIABLE_APPEND_WRITE.patch

00e791
From 85c837d67fef9cd831a3126398ed8da1421f61c5 Mon Sep 17 00:00:00 2001
00e791
From: Gary Lin <glin@suse.com>
00e791
Date: Fri, 11 May 2018 16:59:03 +0800
00e791
Subject: [PATCH 09/62] MokManager: Stop using EFI_VARIABLE_APPEND_WRITE
00e791
00e791
When writing MokList with EFI_VARIABLE_APPEND_WRITE, some HP laptops
00e791
may just return EFI_SUCCESS without writing the content into the flash,
00e791
so we have no way to detect if MokList is updated or not. Now we always
00e791
read MokList first and write it back with the new content.
00e791
00e791
https://github.com/rhboot/shim/issues/105
00e791
00e791
Signed-off-by: Gary Lin <glin@suse.com>
00e791
Upstream-commit-id: f442c8424b4
00e791
---
00e791
 MokManager.c | 11 +++--------
00e791
 1 file changed, 3 insertions(+), 8 deletions(-)
00e791
00e791
diff --git a/MokManager.c b/MokManager.c
00e791
index 0767e4a6cde..df9b6fe6912 100644
00e791
--- a/MokManager.c
00e791
+++ b/MokManager.c
00e791
@@ -880,14 +880,9 @@ static EFI_STATUS write_db(CHAR16 * db_name, void *MokNew, UINTN MokNewSize)
00e791
 	UINTN old_size;
00e791
 	UINTN new_size;
00e791
 
00e791
-	efi_status = gRT->SetVariable(db_name, &SHIM_LOCK_GUID,
00e791
-				      EFI_VARIABLE_NON_VOLATILE |
00e791
-				      EFI_VARIABLE_BOOTSERVICE_ACCESS |
00e791
-				      EFI_VARIABLE_APPEND_WRITE,
00e791
-				      MokNewSize, MokNew);
00e791
-	if (!EFI_ERROR(efi_status) || efi_status != EFI_INVALID_PARAMETER) {
00e791
-		return efi_status;
00e791
-	}
00e791
+	/* Do not use EFI_VARIABLE_APPEND_WRITE due to faulty firmwares.
00e791
+	 * ref: https://github.com/rhboot/shim/issues/55
00e791
+	 *      https://github.com/rhboot/shim/issues/105 */
00e791
 
00e791
 	efi_status = get_variable_attr(db_name, (UINT8 **)&old_data, &old_size,
00e791
 				       SHIM_LOCK_GUID, &attributes);
00e791
-- 
00e791
2.26.2
00e791