Blame SOURCES/0002-mok-fix-the-mirroring-of-RT-variables.patch

24a050
From 4b27ae034ba9885960e72f77b3f687a9b7fea824 Mon Sep 17 00:00:00 2001
24a050
From: Gary Lin <glin@suse.com>
24a050
Date: Wed, 21 Nov 2018 12:47:43 +0800
24a050
Subject: [PATCH 2/3] mok: fix the mirroring of RT variables
24a050
24a050
When there is no key in MokList, import_mok_state() just skipped MokList
24a050
even though it should always mirror the vendor cert. Besides, the faulty
24a050
check of 'present' and 'addend' invalidates the mirroring of MokListXRT,
24a050
MokSBStateRT, and MokIgnoreDB.
24a050
24a050
https://github.com/rhboot/shim/issues/154
24a050
24a050
Signed-off-by: Gary Lin <glin@suse.com>
24a050
---
24a050
 mok.c | 11 ++++-------
24a050
 1 file changed, 4 insertions(+), 7 deletions(-)
24a050
24a050
diff --git a/mok.c b/mok.c
24a050
index 00dd1ad3034..41925abbb49 100644
24a050
--- a/mok.c
24a050
+++ b/mok.c
24a050
@@ -231,12 +231,8 @@ EFI_STATUS import_mok_state(EFI_HANDLE image_handle)
24a050
 					       &v->data, &v->data_size,
24a050
 					       *v->guid, &attrs);
24a050
 		if (efi_status == EFI_NOT_FOUND) {
24a050
-			if (v->rtname && addend) {
24a050
-				efi_status = mirror_one_mok_variable(v);
24a050
-				if (EFI_ERROR(efi_status) &&
24a050
-				    ret != EFI_SECURITY_VIOLATION)
24a050
-					ret = efi_status;
24a050
-			}
24a050
+			if (addend)
24a050
+				goto mirror_addend;
24a050
 			/*
24a050
 			 * after possibly adding, we can continue, no
24a050
 			 * further checks to be done.
24a050
@@ -316,7 +312,8 @@ EFI_STATUS import_mok_state(EFI_HANDLE image_handle)
24a050
 			}
24a050
 		}
24a050
 
24a050
-		if (v->rtname && present && addend) {
24a050
+mirror_addend:
24a050
+		if (v->rtname && (present || addend)) {
24a050
 			if (v->flags & MOK_MIRROR_DELETE_FIRST)
24a050
 				LibDeleteVariable(v->rtname, v->guid);
24a050
 
24a050
-- 
24a050
2.20.1
24a050