diff mbox series

efi/bgrt: Accept BGRT tables with a version of 0 on Lenovo laptops

Message ID 20200126150231.6021-1-hdegoede@redhat.com
State New
Headers show
Series efi/bgrt: Accept BGRT tables with a version of 0 on Lenovo laptops | expand

Commit Message

Hans de Goede Jan. 26, 2020, 3:02 p.m. UTC
Some (somewhat older) Lenovo laptops have a correct BGRT table, except
that the version field is 0 instead of 1.

Quickly after finding this out, even before submitting a first version of
this patch upstream, the list of DMI matches for affected models grew to
3 models (all Ivy Bridge based).

So rather then maintaining an ever growing list with DMI matches for
affected Lenovo models, this commit simply checks if the vendor is Lenovo
when the version is 0 and in that case accepts the out of spec version
working around the Lenovo firmware bug.

Cc: stable@vger.kernel.org
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1791273
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/firmware/efi/efi-bgrt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c
index b07c17643210..3a2d6d3a590b 100644
--- a/drivers/firmware/efi/efi-bgrt.c
+++ b/drivers/firmware/efi/efi-bgrt.c
@@ -15,6 +15,7 @@ 
 #include <linux/acpi.h>
 #include <linux/efi.h>
 #include <linux/efi-bgrt.h>
+#include <linux/dmi.h>
 
 struct acpi_table_bgrt bgrt_tab;
 size_t bgrt_image_size;
@@ -42,7 +43,12 @@  void __init efi_bgrt_init(struct acpi_table_header *table)
 		return;
 	}
 	*bgrt = *(struct acpi_table_bgrt *)table;
-	if (bgrt->version != 1) {
+	/*
+	 * Some older Lenovo laptops have a correct BGRT table, except that
+	 * the version field is 0 instead of 1.
+	 */
+	if (bgrt->version != 1 &&
+	    !(bgrt->version == 0 && dmi_name_in_vendors("LENOVO"))) {
 		pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n",
 		       bgrt->version);
 		goto out;