grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix a segfault in lsefi


From: Peter Jones
Subject: [PATCH] Fix a segfault in lsefi
Date: Wed, 19 Jul 2017 15:47:41 -0400

From: Rob Clark <address@hidden>

when protocols_per_handle returns error, we can't use the pointers we
passed to it, and that includes trusting num_protocols.

Signed-off-by: Peter Jones <address@hidden>
---
 grub-core/commands/efi/lsefi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
index d901c3892..d1ce99af4 100644
--- a/grub-core/commands/efi/lsefi.c
+++ b/grub-core/commands/efi/lsefi.c
@@ -109,8 +109,10 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ 
((unused)),
 
       status = efi_call_3 
(grub_efi_system_table->boot_services->protocols_per_handle,
                           handle, &protocols, &num_protocols);
-      if (status != GRUB_EFI_SUCCESS)
+      if (status != GRUB_EFI_SUCCESS) {
        grub_printf ("Unable to retrieve protocols\n");
+       continue;
+      }
       for (j = 0; j < num_protocols; j++)
        {
          for (k = 0; k < ARRAY_SIZE (known_protocols); k++)
-- 
2.13.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]