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

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