Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1624989ybv; Fri, 21 Feb 2020 00:31:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzCgJvrPGUxevrujBaYf+VI38Km3oV/IbyM6SXTMG6o8UzFOaW3weKSABBvT9LJeb9qKa2g X-Received: by 2002:a9d:6b95:: with SMTP id b21mr25775485otq.96.1582273870562; Fri, 21 Feb 2020 00:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273870; cv=none; d=google.com; s=arc-20160816; b=iPc8DdbLvICsB0LI5qIMoGuwYgZX0BPUHG7c/2SNflHkhVzLZZrRi5PNgu+ckgsQg4 SWUmH32MQH4PAx3a5l0OuSKp+GvVZHHfgd1CcceP7BrLhNk3qGs5KDVXIZsL2tkG1u65 VPdeGU/1flaHpIoDwxs+MESIErTCf7DX7Qe38ooRsxxkMJE91Uox2vC1csuvIZW9OlyJ lfSTv3yKz+75ZzaV71LP36v4zp5ayv7GDsfWvOnXs5m8dcTir1R8Suqz6+IFaxMs/tIg EijRTePkbFB9kJF3aUAwGk7lzKK7NR1WiMsBfsgNI+CU5hqRNz7Vcollbxoew2/anesl /0Vg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hbKB0P/mH1/FYkJZHUNoPqBD/XFRBuKViBPaCrwOzj8=; b=sx0BTb4cBWFZSmS94DW3jG2hKZxk6pEm+PxiTvce8nbIlfGxhKKd30Kc3mZaDhhQpJ 4jA6k5q5aOHI3dC9bXFDFXA7+3zlpbAbBUalJlhx5EJiKOJnEk53mLnp3J/ur3u/Wc+x tFnBK8EpoOfrpApznYfOIdrReCWSXJsrXosq3e7BOGOckafFV/Zr3tCdldGNYir40H6y avGPFVOnPf89oPVjHN1+kZmjTBD1bV6eKJYe24n0ZOCq/u6DqDqN36K6APfr2LcYTUK/ /MgdfdCiaerS5K+EKD0kEe2UoZk0nnaNAS/w3b80k3jhSVqBsZVSZ1TQzLQKBJqKoFfu RLpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JXemThig; 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 69si1209948otv.190.2020.02.21.00.30.58; Fri, 21 Feb 2020 00:31:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=JXemThig; 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 S2388045AbgBUI3T (ORCPT + 99 others); Fri, 21 Feb 2020 03:29:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:55626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387753AbgBUIR5 (ORCPT ); Fri, 21 Feb 2020 03:17:57 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95B0B24689; Fri, 21 Feb 2020 08:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273077; bh=gAkfpv4ncOrLT6/j6G/W8e8xXZzuNMbpqDoVeHHi7gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXemThigWVclufvGL6XqWBWMypLWd8IBRxtXxx0BqBOVBiVAstYoJeYkLB/+jzf2J fiRt+F3ghpzD4kQx15lY60IO1KaZkmR01y/CDwvfVoaJIemarBDDlfleWf7tn7utXR dnzWFHq0eVyJhThSW25veVAfzZwqOJBHNEq4XD4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christopher Head , Arvind Sankar , Borislav Petkov , Sasha Levin Subject: [PATCH 4.19 037/191] x86/sysfb: Fix check for bad VRAM size Date: Fri, 21 Feb 2020 08:40:10 +0100 Message-Id: <20200221072256.070751725@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arvind Sankar [ Upstream commit dacc9092336be20b01642afe1a51720b31f60369 ] 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 Signed-off-by: Sasha Levin --- 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 85195d447a922..f3215346e47fd 100644 --- a/arch/x86/kernel/sysfb_simplefb.c +++ b/arch/x86/kernel/sysfb_simplefb.c @@ -94,11 +94,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)); -- 2.20.1