From patchwork Fri May 17 21:05:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 2584471 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EB02DDF215 for ; Fri, 17 May 2013 21:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756080Ab3EQVFp (ORCPT ); Fri, 17 May 2013 17:05:45 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:45077 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756078Ab3EQVFo (ORCPT ); Fri, 17 May 2013 17:05:44 -0400 Received: by mail-pa0-f54.google.com with SMTP id kx1so3930864pab.27 for ; Fri, 17 May 2013 14:05:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=FxOQwoHIZkCJI+0FyY5Qy4rKx5VfPslsEmWm2R61g7U=; b=KgvT/JdLVQnBbD0gpOjcAftD/+qrZDqoOhUktmGtC+zNyggWKFfcsNjXUFtMYkDa4E xh7Piz7/MeOd+WRAowDr1ZeCM2g2J/XsN7kl9CZy5eK7RIPHXeU0zFy8a4RkC9fo6fJi 3L0ZqlplylKm43t5iLJZr5/zT025Q5mt+DtqbN5cgUiAqfqICsHZHd95oYe5VLDCmYvw kpd1JI7HWcffKjyI3UJ2oC1brkulmkQJwyPsSo6C0dxqhWJRUjPm3Eky3dVObrweb+Ov TzuASYA60+v6Q5TRmWVoJZrHAA7YuVw/nktHUYsDBNk8sRUlQYVhZ9Ag3kJ3m3Y6eXvh 2Brg== X-Received: by 10.68.37.100 with SMTP id x4mr43559172pbj.122.1368824744297; Fri, 17 May 2013 14:05:44 -0700 (PDT) Received: from localhost (50-76-60-73-ip-static.hfc.comcastbusiness.net. [50.76.60.73]) by mx.google.com with ESMTPSA id vz8sm13629123pac.20.2013.05.17.14.05.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 17 May 2013 14:05:42 -0700 (PDT) From: Andy Lutomirski To: Linux ACPI , Josh Triplett , Matthew Garrett Cc: Andy Lutomirski Subject: [PATCH] efi: Work around bogus pointers in BGRT Date: Fri, 17 May 2013 14:05:33 -0700 Message-Id: <7ccd9d84f7407ba65c1f03d144e2113dee0d797a.1368824585.git.luto@amacapital.net> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: References: X-Gm-Message-State: ALoCoQk6eTWXPuQ1DTMLvBji6ed2wuGWa4QfsCM4uNDhCWLstpnv9TkA+gJLJeSNvEfRC+giquog Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- 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)