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

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