aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2026-09-24 07:22:16 +0000
committerWarner Losh <imp@FreeBSD.org>2026-09-24 07:22:25 +0000
commitb5f0e7f36afc20bf17e9e955454b445d686cda06 (patch)
tree4997f82c5ce03cd34fc146aab26e118a1f4d7c24
parent85fb40bad584e7d8c503e5a99bb81cc2d3cf9fee (diff)
loader.efi: Be cautious about using GOPs
When we're searching for the EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID (GOPs) to use, skip any whose Mode or Mode->Info pointers are NULL. The spec requires these to be non-null, however, some firmwares seem to fail to populate the Info when, for example, a monitor is not present. Work around these bugs by skipping any GOPs with bad pointers. PR: 288900 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D59830
-rw-r--r--stand/efi/loader/framebuffer.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c
index 632377613f58..6a95a1b98db4 100644
--- a/stand/efi/loader/framebuffer.c
+++ b/stand/efi/loader/framebuffer.c
@@ -632,7 +632,14 @@ efi_find_framebuffer(teken_gfx_t *gfx_state)
if (status != EFI_SUCCESS)
continue;
- if (tgop->Mode->Info->PixelFormat == PixelBltOnly ||
+ /*
+ * Some platforms half initialize the graphics protocol
+ * here when no monitor present, even though spec says
+ * they are non-optional. Windows and Linux don't access
+ * Mode->Info generally, so such bugs can slip through.
+ */
+ if (tgop->Mode == NULL || tgop->Mode->Info == NULL ||
+ tgop->Mode->Info->PixelFormat == PixelBltOnly ||
tgop->Mode->Info->PixelFormat >= PixelFormatMax)
continue;