Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Dec 2017 06:37:12 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326421 - head/stand/efi/libefi
Message-ID:  <201712010637.vB16bCfD076539@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Fri Dec  1 06:37:12 2017
New Revision: 326421
URL: https://svnweb.freebsd.org/changeset/base/326421

Log:
  loader.efi: efipart should exclude iPXE stub block protocol
  
  iPXE does insert stub  BLOCK IO protocol handle to rework other issues,
  this handle is not usable as it does not provide actual implementation.
  
  We can detect this situation by checking and validating the BlockSize
  property, so this update does make sure we have BlockSize at least 512B
  and its value is power of 2.
  
  PR:		223969
  Reported by:	Jeff Pieper
  Reviewed by:	imp
  Differential Revision:	https://reviews.freebsd.org/D13297

Modified:
  head/stand/efi/libefi/efipart.c

Modified: head/stand/efi/libefi/efipart.c
==============================================================================
--- head/stand/efi/libefi/efipart.c	Fri Dec  1 05:57:05 2017	(r326420)
+++ head/stand/efi/libefi/efipart.c	Fri Dec  1 06:37:12 2017	(r326421)
@@ -257,6 +257,14 @@ efipart_hdd(EFI_DEVICE_PATH *dp)
 		    !blkio->Media->MediaPresent) {
 			return (false);
 		}
+
+		/*
+		 * We assume the block size 512 or greater power of 2. 
+		 */
+		if (blkio->Media->BlockSize < 512 ||
+		    !powerof2(blkio->Media->BlockSize)) {
+			return (false);
+		}
 	}
 	return (true);
 }



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