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

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