]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
efi/libstub: gop: Fix EDID support in mixed-mode
authorHans de Goede <johannes.goede@oss.qualcomm.com>
Tue, 23 Dec 2025 10:10:46 +0000 (11:10 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 24 Dec 2025 20:32:31 +0000 (21:32 +0100)
The efi_edid_discovered_protocol and efi_edid_active_protocol have mixed
mode fields. So all their attributes should be accessed through
the efi_table_attr() helper.

Doing so fixes the upper 32 bits of the 64 bit gop_edid pointer getting
set to random values (followed by a crash at boot) when booting a x86_64
kernel on a machine with 32 bit UEFI like the Asus T100TA.

Fixes: 17029cdd8f9d ("efi/libstub: gop: Add support for reading EDID")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/gop.c

index 72d74436a7a4417e46219203411c1b5c3727edc1..80dc8cfeb33e961295384d9d1a2b619323e13859 100644 (file)
@@ -513,15 +513,15 @@ efi_status_t efi_setup_graphics(struct screen_info *si, struct edid_info *edid)
                status = efi_bs_call(handle_protocol, handle, &EFI_EDID_ACTIVE_PROTOCOL_GUID,
                                     (void **)&active_edid);
                if (status == EFI_SUCCESS) {
-                       gop_size_of_edid = active_edid->size_of_edid;
-                       gop_edid = active_edid->edid;
+                       gop_size_of_edid = efi_table_attr(active_edid, size_of_edid);
+                       gop_edid = efi_table_attr(active_edid, edid);
                } else {
                        status = efi_bs_call(handle_protocol, handle,
                                             &EFI_EDID_DISCOVERED_PROTOCOL_GUID,
                                             (void **)&discovered_edid);
                        if (status == EFI_SUCCESS) {
-                               gop_size_of_edid = discovered_edid->size_of_edid;
-                               gop_edid = discovered_edid->edid;
+                               gop_size_of_edid = efi_table_attr(discovered_edid, size_of_edid);
+                               gop_edid = efi_table_attr(discovered_edid, edid);
                        }
                }