From patchwork Sun Jan 26 15:02:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 11351895 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6229D921 for ; Sun, 26 Jan 2020 15:02:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 405602075D for ; Sun, 26 Jan 2020 15:02:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CDozTJIq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726080AbgAZPCi (ORCPT ); Sun, 26 Jan 2020 10:02:38 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35196 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725773AbgAZPCi (ORCPT ); Sun, 26 Jan 2020 10:02:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580050957; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=6/+tHocZErL7Y6LXRM3rxyHptPaj/JOElin4yBKSSZU=; b=CDozTJIqyIm1Uth+KA5c94VEmKZd85xyc9S1AkoUZnG2ft9Kka+TINIR/JqdgCf3BS1X3W SU5I7W4dC5z4rnZix+z/A+SmJmHATaN6pihBPBpXBbYIyKaICcNyb3V4t39utR3borBKYh esfcu1Q62WZphrpnqUg0AtLcKe5uEXU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-qJ8BVGLqPLqXazyL2SLcRg-1; Sun, 26 Jan 2020 10:02:34 -0500 X-MC-Unique: qJ8BVGLqPLqXazyL2SLcRg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B427A800D41; Sun, 26 Jan 2020 15:02:33 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9895E806B7; Sun, 26 Jan 2020 15:02:32 +0000 (UTC) From: Hans de Goede To: Ard Biesheuvel Cc: Hans de Goede , linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] efi/bgrt: Accept BGRT tables with a version of 0 on Lenovo laptops Date: Sun, 26 Jan 2020 16:02:31 +0100 Message-Id: <20200126150231.6021-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- drivers/firmware/efi/efi-bgrt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 #include #include +#include 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;