Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3166215imw; Mon, 11 Jul 2022 03:20:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sjqTg0fShAo7wWY1R49tg+4IsW1fppM1Za+YaSk50d8bIN3M/SDpvam3GUQCsa098Ggl4B X-Received: by 2002:a17:907:6e03:b0:726:a6a3:7515 with SMTP id sd3-20020a1709076e0300b00726a6a37515mr18082876ejc.676.1657534838198; Mon, 11 Jul 2022 03:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657534838; cv=none; d=google.com; s=arc-20160816; b=A8EsqgHrki2OE0okASjr30UwV4RJazHULUj0tapuOxVlsIPEZwoeKOKDuO4mK1l91c Cnj/o8gGuyGBayZnRV799AlyjQ8dTui8CUdCmZxM3k522L8EHPnV5pcMPUgb7RAOGLmL 3j4MPCMjcD/3MvBZGMZ4lj1fKSBP48Dg6DapOm6ip404cLk/6AvDT/IsJbXlWvNCctud +hF2WKSqEFVEKsuMGKwTAPFo5OLAJB4AXxud13Ebe5OvgNOD4f/pqMlLoeT9p/akhEOy F47wM737ntdEpENnbHBdX5BDuJTPTn0VsgXD6dfAyFSbLQqlry4Pmd7Tf91GCOC7t05K 1NMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wMrOUgrw3cgQou5UGIxPh+P+Rga00YWv8BEa6HbtqX4=; b=X6DQvgR5Vv0YE5Ll5q7WL/q1/MEbOI3JZFy4AcAG8zJHcuwLhc2taKt9WdqZuXo/m1 O1F+9YIe2bIjWczpndEyHe1w0quewrWSCU3ZIy7C9DuOEef+zpZV9cDNdfxOVX9FaTv5 IRjCcjgGPsEzjiRbw5Amrirv58qexgdk3QNauhVQQB6dxCekfNhmXXZE15qZ7WUK7N2q au2ClDeeF0spzsefWtFlkpHWyinnwynFBiB9vgQjAY81Y2C0r+NQCiy42DXOO76J0NzK /MwDWJgykhucvAZpw3hiNG/N2vT7FJ8q2+QjY15B03Rdk3wWuzlTVu69eR6FkBGUbrZ1 NkTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qAAapBeG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eg29-20020a056402289d00b004358145e6e1si8263074edb.209.2022.07.11.03.20.13; Mon, 11 Jul 2022 03:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qAAapBeG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbiGKJME (ORCPT + 99 others); Mon, 11 Jul 2022 05:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbiGKJLR (ORCPT ); Mon, 11 Jul 2022 05:11:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8605A1262D; Mon, 11 Jul 2022 02:09:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 714F46115B; Mon, 11 Jul 2022 09:08:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C4E3C34115; Mon, 11 Jul 2022 09:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530538; bh=Zh7XzfrXu2lZA8USWPkjYJ5nKN75L6QE/SiI/vL2YmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qAAapBeGvmD+ouNatAgsEn959FpOyDmILh2xTQfqUttIQCecWnav2e5yV7THbEqVO 6hrmvRTi5esg+39209beFFvUTasfGdEvgYRdNBtF61PbsrqFEa/48CyNs2EdJoiSqL 7cvpLXsHnGytEWcP8XLP9vHsM9xFCLziQXWkxqus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , Daniel Vetter , Geert Uytterhoeven Subject: [PATCH 4.19 09/31] fbcon: Disallow setting font bigger than screen size Date: Mon, 11 Jul 2022 11:06:48 +0200 Message-Id: <20220711090538.122095708@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090537.841305347@linuxfoundation.org> References: <20220711090537.841305347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Helge Deller commit 65a01e601dbba8b7a51a2677811f70f783766682 upstream. Prevent that users set a font size which is bigger than the physical screen. It's unlikely this may happen (because screens are usually much larger than the fonts and each font char is limited to 32x32 pixels), but it may happen on smaller screens/LCD displays. Signed-off-by: Helge Deller Reviewed-by: Daniel Vetter Reviewed-by: Geert Uytterhoeven Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbcon.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2468,6 +2468,11 @@ static int fbcon_set_font(struct vc_data if (charcount != 256 && charcount != 512) return -EINVAL; + /* font bigger than screen resolution ? */ + if (w > FBCON_SWAP(info->var.rotate, info->var.xres, info->var.yres) || + h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) + return -EINVAL; + /* Make sure drawing engine can handle the font */ if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || !(info->pixmap.blit_y & (1 << (font->height - 1))))