Received: from list by lists.gnu.org with archive (Exim 4.71) id 1dXv60-0006cz-6q for mharc-grub-devel@gnu.org; Wed, 19 Jul 2017 15:57:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXv5x-0006cs-AD for grub-devel@gnu.org; Wed, 19 Jul 2017 15:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXv5u-0001jh-4X for grub-devel@gnu.org; Wed, 19 Jul 2017 15:57:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35698) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXv5t-0001ia-Uu for grub-devel@gnu.org; Wed, 19 Jul 2017 15:57:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE2AD8BD26 for ; Wed, 19 Jul 2017 19:47:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BE2AD8BD26 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pjones@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BE2AD8BD26 Received: from trillian.uncooperative.org.com (dhcp-10-20-1-221.bss.redhat.com [10.20.1.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44A7778406; Wed, 19 Jul 2017 19:47:45 +0000 (UTC) From: Peter Jones To: grub-devel@gnu.org Cc: Rob Clark , Peter Jones Subject: [PATCH] Fix a segfault in lsefi Date: Wed, 19 Jul 2017 15:47:41 -0400 Message-Id: <20170719194741.8800-1-pjones@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 19 Jul 2017 19:47:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2017 19:57:18 -0000 From: Rob Clark 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 --- 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