Path: csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod From: Matt Fleming Newsgroups: linux.kernel Subject: [PATCH 09/14] x86/efi-bgrt: Don't ignore the BGRT if the 'valid' bit is 0 Date: Mon, 01 Feb 2016 23:10:04 +0100 Message-ID: References: Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=gjzaHrNrdTcq6cxMy0dRy8lM8OU8ZGOO3SnlsfZCFBY=; b=kIYhS9gvqhSMxVK38UBt34/Svt/3Gb3Fl4bHMdMdOyAN4u5jKHJHi12hpw3WGEnoZL xTEpwKBqDjjTkUKVhrMQk/D7+cCOdswFChwiFn26wnUwJv0wn1Jd2RoHyu9EVGgrIRzj 2CM9VfMg6Rfr8edZ4uszVAIQdirYgl0E0DvB+2XryhFv+qPV8PuvWX/Bq8k9QqGLnaev nSplqT/PUS5cckaU1LI0lohwv3rzGqC3KoFCWdat3hqE/NzOkWShJzaErFf/lGpyPj0X vJ33xag/7bAYeEXVbZDd69/2FsUBMnvMLYEV/d5tKBZBny2jF9MN/7TXXFSpJtfyCPg7 jWCg== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=gjzaHrNrdTcq6cxMy0dRy8lM8OU8ZGOO3SnlsfZCFBY=; b=OgkviDUqQZVkkmQa4NBrMgAq2TK+2DCWdxH7PfSX0O+BNZ1XXxYGuBJTCrmUlQVJUW scaWMFBeSDIbR89ObiInWb/X/uTwLOvqiNxuXKsW+J8YjWvFr8HSeE/PHtNM8HRrCR4e nqaFh5eeGgnfCDlF09zfGyQJyakPvLCOV+xSCf0zQAE3s/IzG+oPSydDqoBD3vXT653R +Lq8oEl2Ab918+1JcjkBvsftknCHpHfT7OW9Qm9uWK/UP/uycJdCK5CYnU2pC2KgmYqw WMXaYDtgJ8czxCEQZ+I+5zZZsIEkB5B/8fnphvAjaHMWXCs4F9380GXr+ua+JPeW7R2Z yMRw== X-Gm-Message-State: AG10YOS+y1kThg2McJU6pwPSvl1QfSiEGnuOo4fj90pJav6CJjD+dRu9y8E5niOgOa6Lug== X-Received: by 10.28.174.196 with SMTP id x187mr14958938wme.2.1454364446565; Mon, 01 Feb 2016 14:07:26 -0800 (PST) X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 49 Organization: linux.* mail to news gateway X-Original-Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?M=C3=B4she=20van=20der=20Sterre?= , Matt Fleming , Josh Triplett X-Original-Date: Mon, 1 Feb 2016 22:07:03 +0000 X-Original-Message-ID: <1454364428-494-10-git-send-email-matt@codeblueprint.co.uk> X-Original-References: <1454364428-494-1-git-send-email-matt@codeblueprint.co.uk> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1323559 From: Môshe van der Sterre 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 --- 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 b0970661870a..a2433817c987 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); -- 2.6.2