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
This commit is contained in:
Toomas Soome 2017-12-01 06:37:12 +00:00
parent 21631605fd
commit e4f6a1bfa3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326421

View File

@ -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);
}