From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757096AbcBCLl5 (ORCPT ); Wed, 3 Feb 2016 06:41:57 -0500 Received: from terminus.zytor.com ([198.137.202.10]:55655 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932516AbcBCLd4 (ORCPT ); Wed, 3 Feb 2016 06:33:56 -0500 Date: Wed, 3 Feb 2016 03:33:35 -0800 From: "=?UTF-8?B?dGlwLWJvdCBmb3IgTcO0c2hlIHZhbiBkZXIgU3RlcnJl?=" Message-ID: Cc: linux-kernel@vger.kernel.org, josh@joshtriplett.org, me@moshe.nl, hpa@zytor.com, mingo@kernel.org, matt@codeblueprint.co.uk, tglx@linutronix.de Reply-To: tglx@linutronix.de, matt@codeblueprint.co.uk, mingo@kernel.org, hpa@zytor.com, me@moshe.nl, josh@joshtriplett.org, linux-kernel@vger.kernel.org In-Reply-To: <1454364428-494-10-git-send-email-matt@codeblueprint.co.uk> References: <1454364428-494-10-git-send-email-matt@codeblueprint.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] x86/efi/bgrt: Don't ignore the BGRT if the 'valid' bit is 0 Git-Commit-ID: 66dbe99cfe30e113d2e571e68b9b6a1a8985a157 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 66dbe99cfe30e113d2e571e68b9b6a1a8985a157 Gitweb: http://git.kernel.org/tip/66dbe99cfe30e113d2e571e68b9b6a1a8985a157 Author: Môshe van der Sterre AuthorDate: Mon, 1 Feb 2016 22:07:03 +0000 Committer: Ingo Molnar CommitDate: Wed, 3 Feb 2016 11:41:19 +0100 x86/efi/bgrt: Don't ignore the BGRT if the 'valid' bit is 0 Unintuitively, the BGRT graphic is apparently meant to be usable if the valid bit in not set. The valid bit only conveys uncertainty about the validity in relation to the screen state. Windows 10 actually uses the BGRT image for its boot screen even if not 'valid', for example when the user triggered the boot menu. Because it is unclear if all firmwares will provide a usable graphic in this case, we now look at the BMP magic number as an additional check. Reviewed-by: Josh Triplett Signed-off-by: Môshe van der Sterre Signed-off-by: Matt Fleming Cc: =?UTF-8?q?M=C3=B4she=20van=20der=20Sterre?= Link: http://lkml.kernel.org/r/1454364428-494-10-git-send-email-matt@codeblueprint.co.uk Signed-off-by: Ingo Molnar --- arch/x86/platform/efi/efi-bgrt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c index b097066..a243381 100644 --- a/arch/x86/platform/efi/efi-bgrt.c +++ b/arch/x86/platform/efi/efi-bgrt.c @@ -57,11 +57,6 @@ void __init efi_bgrt_init(void) bgrt_tab->status); return; } - if (bgrt_tab->status != 1) { - pr_debug("Ignoring BGRT: invalid status %u (expected 1)\n", - bgrt_tab->status); - return; - } if (bgrt_tab->image_type != 0) { pr_err("Ignoring BGRT: invalid image type %u (expected 0)\n", bgrt_tab->image_type); @@ -80,6 +75,11 @@ void __init efi_bgrt_init(void) memcpy(&bmp_header, image, sizeof(bmp_header)); memunmap(image); + if (bmp_header.id != 0x4d42) { + pr_err("Ignoring BGRT: Incorrect BMP magic number 0x%x (expected 0x4d42)\n", + bmp_header.id); + return; + } bgrt_image_size = bmp_header.size; bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);