!105 verifiers: Fix calling uninitialized function pointer
From: @zhangqiumiao Reviewed-by: @orange-snn Signed-off-by: @orange-snn
This commit is contained in:
commit
f993214903
@ -0,0 +1,46 @@
|
|||||||
|
From 53d2cf59c7c683f473a43007303a30c1e3e8baad 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.
|
||||||
|
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit/?id=d0de8b37f651e13886ef0e0fda285a1294adafe8
|
||||||
|
|
||||||
|
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/kern/verifiers.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/grub-core/kern/verifiers.c b/grub-core/kern/verifiers.c
|
||||||
|
index aa3dc7c..3d19bff 100644
|
||||||
|
--- a/grub-core/kern/verifiers.c
|
||||||
|
+++ b/grub-core/kern/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);
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
||||||
@ -351,3 +351,4 @@ Patch0350: backport-0077-efi-tpm-Fix-memory-leak-in-grub_tpm1-2_log_event.patch
|
|||||||
Patch0351: backport-0078-powerpc-mkimage-Fix-CHRP-note-descsz.patch
|
Patch0351: backport-0078-powerpc-mkimage-Fix-CHRP-note-descsz.patch
|
||||||
Patch0352: backport-0079-efi-tpm-Fix-typo-in-grub_efi_tpm2_protocol-struct.patch
|
Patch0352: backport-0079-efi-tpm-Fix-typo-in-grub_efi_tpm2_protocol-struct.patch
|
||||||
Patch0353: backport-0080-misc-Add-parentheses-around-ALIGN_UP-and-ALIGN_DOWN-.patch
|
Patch0353: backport-0080-misc-Add-parentheses-around-ALIGN_UP-and-ALIGN_DOWN-.patch
|
||||||
|
Patch0354: backport-0081-verifiers-Fix-calling-uninitialized-function-pointer.patch
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
Name: grub2
|
Name: grub2
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 2.04
|
Version: 2.04
|
||||||
Release: 19
|
Release: 20
|
||||||
Summary: Bootloader with support for Linux, Multiboot and more
|
Summary: Bootloader with support for Linux, Multiboot and more
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/grub/
|
URL: http://www.gnu.org/software/grub/
|
||||||
@ -451,6 +451,12 @@ rm -r /boot/grub2.tmp/ || :
|
|||||||
%{_datadir}/man/man*
|
%{_datadir}/man/man*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Sep 27 2021 zhangqiumiao <zhangqiumiao1@huawei.com> - 2.04-20
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:verifiers: Fix calling uninitialized function pointer
|
||||||
|
|
||||||
* Mon Aug 02 2021 gaihuiying <gaihuiying1@huawei.com> - 2.04-19
|
* Mon Aug 02 2021 gaihuiying <gaihuiying1@huawei.com> - 2.04-19
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user