[PATCH] efi: Work around bogus pointers in BGRT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The MSI MS-7760 supplies a BGRT marked "invalid" that contains a
pointer to nowhere.  Since an "invalid" BGRT isn't particularly
useful (userspace isn't supposed to use it anyway), ignore the BGRT
if it's marked "invalid" and the pointer points outside of EFI boot
services space.

Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
---
This seems to fix the problem for me.

 arch/x86/platform/efi/efi-bgrt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 7145ec6..c77b7cf 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -49,6 +49,18 @@ void __init efi_bgrt_init(void)
 
 	image = efi_lookup_mapped_addr(bgrt_tab->image_address);
 	if (!image) {
+		if (!(bgrt_tab->status & 1)) {
+			/*
+			 * The MSI MS-7760 exposes an "invalid" BGRT
+			 * containing a pointer to nowhere.  This heuristic
+			 * will avoid following that pointer.  (The idea
+			 * is that an "invalid" image pointing into boot
+			 * services data is probably sensible, but other
+			 * "invalid" pointers are questionable.)
+			 */
+			return;
+		}
+
 		image = ioremap(bgrt_tab->image_address, sizeof(bmp_header));
 		ioremapped = true;
 		if (!image)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux