diff mbox

[2/5] unhook_system_services: bail on systab == NULL

Message ID 1407850402-11193-3-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel Aug. 12, 2014, 1:33 p.m. UTC
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 mbox

Patch

diff --git a/replacements.c b/replacements.c
index 48dc43785e2d..5dfa35567184 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;