2021-03-30 15:50:09 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Michael Chang <mchang@suse.com>
|
|
|
|
Date: Tue, 18 Feb 2020 18:08:18 +0800
|
|
|
|
Subject: [PATCH] verifiers: Fix calling uninitialized function pointer
|
|
|
|
|
|
|
|
The necessary check for NULL before use of function ver->close is not
|
|
|
|
taking place in the failure path. This patch simply adds the missing
|
|
|
|
check and fixes the problem that GRUB hangs indefinitely after booting
|
|
|
|
rogue image without valid signature if secure boot is turned on.
|
|
|
|
|
|
|
|
Now it displays like this for booting rogue UEFI image:
|
|
|
|
|
|
|
|
error: bad shim signature
|
|
|
|
error: you need to load the kernel first
|
|
|
|
|
|
|
|
Press any key to continue...
|
|
|
|
|
|
|
|
and then you can go back to boot menu by pressing any key or after a few
|
|
|
|
seconds expired.
|
|
|
|
|
|
|
|
Signed-off-by: Michael Chang <mchang@suse.com>
|
|
|
|
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
|
---
|
|
|
|
grub-core/commands/verifiers.c | 3 ++-
|
|
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/grub-core/commands/verifiers.c b/grub-core/commands/verifiers.c
|
2022-03-29 18:03:52 +00:00
|
|
|
index c638d5f43..599d79b75 100644
|
2021-03-30 15:50:09 +00:00
|
|
|
--- a/grub-core/commands/verifiers.c
|
|
|
|
+++ b/grub-core/commands/verifiers.c
|
|
|
|
@@ -196,7 +196,8 @@ grub_verifiers_open (grub_file_t io, enum grub_file_type type)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
- ver->close (context);
|
|
|
|
+ if (ver->close)
|
|
|
|
+ ver->close (context);
|
|
|
|
fail_noclose:
|
|
|
|
verified_free (verified);
|
|
|
|
grub_free (ret);
|