Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2017 17:15:55 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325744 - head/sys/boot/efi/boot1
Message-ID:  <201711121715.vACHFtsD028841@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sun Nov 12 17:15:54 2017
New Revision: 325744
URL: https://svnweb.freebsd.org/changeset/base/325744

Log:
  boot1: also check for NULL device
  
  r325681 fixed a NULL pointer dereference on RPi3 caused by a lack of
  functionality in uboot's EFI implementation.  That rev checked the boot1
  load path for NULL but not the load device.  In practice if the former
  works the latter will as well, but improve correctness by checking each
  separately.
  
  Submitted by:	Keith White <kwhite@eecs.uottawa.ca>
  Reported by:	jhb
  MFC after:	5 days
  MFC with:	r325681
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/boot/efi/boot1/boot1.c

Modified: head/sys/boot/efi/boot1/boot1.c
==============================================================================
--- head/sys/boot/efi/boot1/boot1.c	Sun Nov 12 17:10:57 2017	(r325743)
+++ head/sys/boot/efi/boot1/boot1.c	Sun Nov 12 17:15:54 2017	(r325744)
@@ -464,14 +464,16 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
 			printf("   Load Path: %S\n", text);
 			efi_setenv_freebsd_wcs("Boot1Path", text);
 			efi_free_devpath_name(text);
+		}
 
-			status = BS->HandleProtocol(img->DeviceHandle,
-			    &DevicePathGUID, (void **)&imgpath);
-			if (status != EFI_SUCCESS) {
-				DPRINTF("Failed to get image DevicePath (%lu)\n",
-				    EFI_ERROR_CODE(status));
-			} else {
-				text = efi_devpath_name(imgpath);
+		status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID,
+		    (void **)&imgpath);
+		if (status != EFI_SUCCESS) {
+			DPRINTF("Failed to get image DevicePath (%lu)\n",
+			    EFI_ERROR_CODE(status));
+		} else {
+			text = efi_devpath_name(imgpath);
+			if (text != NULL) {
 				printf("   Load Device: %S\n", text);
 				efi_setenv_freebsd_wcs("Boot1Dev", text);
 				efi_free_devpath_name(text);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711121715.vACHFtsD028841>