bbc6a8
From e8ab5a1a9e2889eb59d1fa494ba441a53698dcd2 Mon Sep 17 00:00:00 2001
dd8457
From: Rob Clark <rclark@redhat.com>
bbc6a8
Date: Wed, 19 Jul 2017 15:47:41 -0400
78e1a1
Subject: [PATCH 050/216] Fix a segfault in lsefi
dd8457
dd8457
when protocols_per_handle returns error, we can't use the pointers we
dd8457
passed to it, and that includes trusting num_protocols.
dd8457
dd8457
Signed-off-by: Peter Jones <pjones@redhat.com>
bbc6a8
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
dd8457
---
bbc6a8
 grub-core/commands/efi/lsefi.c | 4 +++-
bbc6a8
 1 file changed, 3 insertions(+), 1 deletion(-)
dd8457
dd8457
diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
ec4acb
index d901c389263..d1ce99af438 100644
dd8457
--- a/grub-core/commands/efi/lsefi.c
dd8457
+++ b/grub-core/commands/efi/lsefi.c
bbc6a8
@@ -109,8 +109,10 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
bbc6a8
 
dd8457
       status = efi_call_3 (grub_efi_system_table->boot_services->protocols_per_handle,
dd8457
 			   handle, &protocols, &num_protocols);
bbc6a8
-      if (status != GRUB_EFI_SUCCESS)
bbc6a8
+      if (status != GRUB_EFI_SUCCESS) {
bbc6a8
 	grub_printf ("Unable to retrieve protocols\n");
bbc6a8
+	continue;
bbc6a8
+      }
dd8457
       for (j = 0; j < num_protocols; j++)
dd8457
 	{
dd8457
 	  for (k = 0; k < ARRAY_SIZE (known_protocols); k++)
dd8457
-- 
ec4acb
2.15.0
dd8457