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

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