Blame SOURCES/0001-fix-verify_mok.patch

f2fa6b
From 11495d4019d44dce1487939f91f7d751ffbb9730 Mon Sep 17 00:00:00 2001
f2fa6b
From: Andrew Boie <andrew.p.boie@intel.com>
f2fa6b
Date: Mon, 15 Apr 2013 14:11:17 -0700
e97c83
Subject: [PATCH 01/74] fix verify_mok()
f2fa6b
f2fa6b
() Fix the return value semantics. If the MokList doesn't
f2fa6b
exist, we are OK. If the MokList was compromised but we
f2fa6b
were able to erase it, that is OK too. Only if the list
f2fa6b
can't be nuked do we return an error.
f2fa6b
f2fa6b
() Fix use of potentially uninitialized attribute variable
f2fa6b
f2fa6b
() Actually use the return value when called from verify_buffer.
f2fa6b
f2fa6b
Change-Id: If16df21d79c52a1726928df96d133390cde4cb7e
f2fa6b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
f2fa6b
---
f2fa6b
 shim.c | 9 +++++----
f2fa6b
 1 file changed, 5 insertions(+), 4 deletions(-)
f2fa6b
f2fa6b
diff --git a/shim.c b/shim.c
f2fa6b
index 23dd0ee..dcb36d0 100644
f2fa6b
--- a/shim.c
f2fa6b
+++ b/shim.c
f2fa6b
@@ -670,13 +670,12 @@ static EFI_STATUS verify_mok (void) {
f2fa6b
 	status = get_variable_attr(L"MokList", &MokListData, &MokListDataSize,
f2fa6b
 				   shim_lock_guid, &attributes);
f2fa6b
 
f2fa6b
-	if (attributes & EFI_VARIABLE_RUNTIME_ACCESS) {
f2fa6b
+	if (!EFI_ERROR(status) && attributes & EFI_VARIABLE_RUNTIME_ACCESS) {
f2fa6b
 		Print(L"MokList is compromised!\nErase all keys in MokList!\n");
f2fa6b
 		if (LibDeleteVariable(L"MokList", &shim_lock_guid) != EFI_SUCCESS) {
f2fa6b
 			Print(L"Failed to erase MokList\n");
f2fa6b
+                        return EFI_ACCESS_DENIED;
f2fa6b
 		}
f2fa6b
-		status = EFI_ACCESS_DENIED;
f2fa6b
-		return status;
f2fa6b
 	}
f2fa6b
 
f2fa6b
 	if (MokListData)
f2fa6b
@@ -722,7 +721,9 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
f2fa6b
 	/*
f2fa6b
 	 * Check that the MOK database hasn't been modified
f2fa6b
 	 */
f2fa6b
-	verify_mok();
f2fa6b
+	status = verify_mok();
f2fa6b
+	if (status != EFI_SUCCESS)
f2fa6b
+		return status;
f2fa6b
 
f2fa6b
 	/*
f2fa6b
 	 * Ensure that the binary isn't blacklisted
f2fa6b
-- 
e97c83
1.9.3
f2fa6b