Skip to contentSkip to conversation

Fix a segfault in lsefi

PATCH Applied Peter Jones 2 participants 3 messages Jul 19, 2017 – Aug 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a segfault in lsefi

From: Rob Clark <[email protected]>

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

---
 grub-core/commands/efi/lsefi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
grub-core/commands/efi/lsefi.c +3 -1
index d901c3892..d1ce99af4 100644
@@ -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++)
Signature · 1 line
2.13.3
Applied
#2 lore raw
Quoted 9 lines · Daniel Kiper
Quoted 6 lines · Peter Jones

From: Rob Clark <[email protected]>

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

LGTM, if there are no objections I will apply it next week.

Applied.

Daniel