All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] verifiers: fix calling uninitialized function pointer
@ 2020-02-18 10:08 Michael Chang
  2020-02-18 11:44 ` Javier Martinez Canillas
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Chang @ 2020-02-18 10:08 UTC (permalink / raw)
  To: grub-devel

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 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>
---
 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
index 0dde48182..7b9297cd3 100644
--- 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);
-- 
2.16.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] verifiers: fix calling uninitialized function pointer
  2020-02-18 10:08 [PATCH] verifiers: fix calling uninitialized function pointer Michael Chang
@ 2020-02-18 11:44 ` Javier Martinez Canillas
  2020-02-18 16:15   ` Daniel Kiper
  0 siblings, 1 reply; 3+ messages in thread
From: Javier Martinez Canillas @ 2020-02-18 11:44 UTC (permalink / raw)
  To: The development of GNU GRUB, Michael Chang

On 2/18/20 11:08 AM, Michael Chang wrote:
> 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 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>

Best regards,
Javier



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] verifiers: fix calling uninitialized function pointer
  2020-02-18 11:44 ` Javier Martinez Canillas
@ 2020-02-18 16:15   ` Daniel Kiper
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Kiper @ 2020-02-18 16:15 UTC (permalink / raw)
  To: mchang, fmartine; +Cc: The development of GNU GRUB

On Tue, Feb 18, 2020 at 12:44:30PM +0100, Javier Martinez Canillas wrote:
> On 2/18/20 11:08 AM, Michael Chang wrote:
> > 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 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> and pushed...

Thanks,

Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-18 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 10:08 [PATCH] verifiers: fix calling uninitialized function pointer Michael Chang
2020-02-18 11:44 ` Javier Martinez Canillas
2020-02-18 16:15   ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.