Blob Blame History Raw
From 77cdb40423e29a5f9d1318cd0ada874ee1916450 Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Tue, 12 Aug 2014 15:33:19 +0200
Subject: [PATCH 46/74] unhook_system_services: bail on systab == NULL

Prevent unhook_system_services() from dereferencing a NULL systab, which
may occur if hook_system_services() has never been called.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 replacements.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/replacements.c b/replacements.c
index 48dc437..5dfa355 100644
--- a/replacements.c
+++ b/replacements.c
@@ -70,6 +70,9 @@ static EFI_HANDLE last_loaded_image;
 void
 unhook_system_services(void)
 {
+	if (!systab)
+		return;
+
 	systab->BootServices->Exit = system_exit;
 	systab->BootServices->LoadImage = system_load_image;
 	systab->BootServices->StartImage = system_start_image;
-- 
1.9.3