Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2404906ybl; Mon, 20 Jan 2020 02:16:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxkROF/k5oOhiUw52lIpGUU/eF6kdjeUMuzX3wbrXVTlwDK/gEh9cVmWUadnREHngkOhtUd X-Received: by 2002:a05:6830:1db5:: with SMTP id z21mr15619699oti.325.1579515392106; Mon, 20 Jan 2020 02:16:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579515392; cv=none; d=google.com; s=arc-20160816; b=spOfwcG4r8UX2iUclSWjYqvtcjViF738V2dp3DrBoHqggA6e9bHLL8J4c+2LYBU4UE jZyJ5fT83X0iEcfh8gHeACmywg+frz0wk2tIDfMVEQMflpKqQWdr5t94Kx2gTPg+ZtxF ++KM8q8fY4e8VaD2BzHY2h6/UG+hQa2jStj6twVkveMJ/6ckBpepIlD+E3QLYStzc3BX wuaNS9wfLUvFyuiW6JRyj9M4orGcv2cuCu/JgdVQ7C7XiiCSmNp87heFM87v40G6bB/X eldtopCPlw0Uno5EVO7tDGmmTah3CjRuPpv+vj1N96twkn2ApdLfq1lYUXZCwLCWZmF2 gmMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=PYsOMiR+HMoLgUfBIsjmJ2eid/vCh1WyDJUG3HIV+FI=; b=DjFvs14Px9Llm4jWDzzDQMx382Q4vEZYCowgx3pdvrhJy+KUqQJ9I+VrinVjti7+EZ 3UdCcVLCnhejdp+lhTqzYvLYcsZCUTQhCVBxfgZr4oLR96VvIfymGjsf94Di3xlYPVVd LVuXPNZtht8JYr1y90sTmL4AEOFcCpb69Rkt4BQmItkOJvdvlyJTyRnyLjevYUeWPLFZ yLG+BonSjsdSw6d6ItB3XbX048paNKTDmFrDA5vi0zLKbjzd3M2gIvF8Ba0FxGi3GzJ8 WnXbrFStZnDskK9suQpdSei+2OuzwCFlUE8SPZWQ/rAMx855Bja3rmMcx7cxKhSYF5DM KF+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l25si19715116otn.69.2020.01.20.02.16.19; Mon, 20 Jan 2020 02:16:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbgATKOS (ORCPT + 99 others); Mon, 20 Jan 2020 05:14:18 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:32831 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgATKOS (ORCPT ); Mon, 20 Jan 2020 05:14:18 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1itU4O-0005BH-Qg; Mon, 20 Jan 2020 11:14:09 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id D3FD11C1A3F; Mon, 20 Jan 2020 11:14:07 +0100 (CET) Date: Mon, 20 Jan 2020 10:14:07 -0000 From: "tip-bot2 for Arvind Sankar" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/sysfb: Fix check for bad VRAM size Cc: Christopher Head , Arvind Sankar , Borislav Petkov , x86 , LKML In-Reply-To: <20200107230410.2291947-1-nivedita@alum.mit.edu> References: <20200107230410.2291947-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Message-ID: <157951524757.396.6875449897563073243.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/boot branch of tip: Commit-ID: dacc9092336be20b01642afe1a51720b31f60369 Gitweb: https://git.kernel.org/tip/dacc9092336be20b01642afe1a51720b31f60369 Author: Arvind Sankar AuthorDate: Tue, 07 Jan 2020 18:04:10 -05:00 Committer: Borislav Petkov CommitterDate: Mon, 20 Jan 2020 10:57:53 +01:00 x86/sysfb: Fix check for bad VRAM size When checking whether the reported lfb_size makes sense, the height * stride result is page-aligned before seeing whether it exceeds the reported size. This doesn't work if height * stride is not an exact number of pages. For example, as reported in the kernel bugzilla below, an 800x600x32 EFI framebuffer gets skipped because of this. Move the PAGE_ALIGN to after the check vs size. Reported-by: Christopher Head Tested-by: Christopher Head Signed-off-by: Arvind Sankar Signed-off-by: Borislav Petkov Link: https://bugzilla.kernel.org/show_bug.cgi?id=206051 Link: https://lkml.kernel.org/r/20200107230410.2291947-1-nivedita@alum.mit.edu --- arch/x86/kernel/sysfb_simplefb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/sysfb_simplefb.c b/arch/x86/kernel/sysfb_simplefb.c index 01f0e22..298fc1e 100644 --- a/arch/x86/kernel/sysfb_simplefb.c +++ b/arch/x86/kernel/sysfb_simplefb.c @@ -90,11 +90,11 @@ __init int create_simplefb(const struct screen_info *si, if (si->orig_video_isVGA == VIDEO_TYPE_VLFB) size <<= 16; length = mode->height * mode->stride; - length = PAGE_ALIGN(length); if (length > size) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); return -EINVAL; } + length = PAGE_ALIGN(length); /* setup IORESOURCE_MEM as framebuffer memory */ memset(&res, 0, sizeof(res));