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

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