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

d1e1c8
From f748139695384fb4e09833898f0b8cb3ab85d810 Mon Sep 17 00:00:00 2001
5b2885
From: Gary Lin <glin@suse.com>
5b2885
Date: Wed, 21 Nov 2018 12:47:43 +0800
d1e1c8
Subject: [PATCH 21/62] 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>
d1e1c8
Upstream-commit-id: 4b27ae034ba
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
-- 
d1e1c8
2.26.2
5b2885