Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3178372imw; Mon, 11 Jul 2022 03:39:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1teVWpq6dOrhOSAwMpXatGP+bkG/UcNdsm/tJ1Ud7ADr0S58YG1Ixoke9VAb/iVX8lcuiqQ X-Received: by 2002:a17:907:6da4:b0:726:9a46:49cd with SMTP id sb36-20020a1709076da400b007269a4649cdmr18080755ejc.12.1657535958287; Mon, 11 Jul 2022 03:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657535958; cv=none; d=google.com; s=arc-20160816; b=yIY+5Gt4Z5TrawqmDo5Wv1229WP/GoCi1w1EYBmaDMVWnTyMvCEfwdnYEoTBaBxxAA v6/ju1KEkm7nKFGWnyx+p9M5g3PF6rbh+lhXtMe09g9Ga7xDX+evcjhq6KoXtuvh6GsO E1qRKAoUV2kWJisD9qJWFB0kXO0W8229Eobx9BW9kkdTozCEeQFBo4ckcqn1eZX4RPlv aP1PVbyBodEX+1JGsratGwvxW1gaQGOWqXZrczLIS2DBw1bA0Wtr0hzP5XcmyG5TH6Dm WI0s0CsLSywCKsJauIxLZdsLfTuJW1/6/+ejOWekaJCAGVVzJ8Y1WhDjbPnCyysOYPXC 2uaQ== 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=jvpyo0wQ9NMDAfDWZN9L54+KVLYsplRafoVvkrre19o=; b=ccBOW+jZB8FIUxKWtIBuWElRbVub6zQlqs7SL5W3K1av3b5gFkADmDKUpo3Va7z+hh AIIWYCztCdxkw6HJ4cZfQdIAtTbz/pTeCPEfDPIYBmqLPEK2wMYjWMY+TjviuzODJITQ dwit54bqx+lKeVbslLNQinV7/LECED9G148sGLaTHOBhvB+0EbjId1qpdw8RgkIJ8kCh nkRfszQQAqNmX3AxIbKg+hAYoJDyyVO578IsFfXaeVLrPu4XCFY14lYRaHpT3xvqFyFP OWvOPkUegjwn1VvEn67QIyjJnTF9cdM2qgt4ix5UV1h4uHtRz1P2CN1SgKYx9J/P+8WA KQrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZKFqocZ; 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 o15-20020a056402438f00b0043a7c1caadasi11320293edc.298.2022.07.11.03.38.54; Mon, 11 Jul 2022 03:39:18 -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=fZKFqocZ; 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 S231152AbiGKJPG (ORCPT + 99 others); Mon, 11 Jul 2022 05:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbiGKJNy (ORCPT ); Mon, 11 Jul 2022 05:13:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E214A286E6; Mon, 11 Jul 2022 02:09:59 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6807AB80D2C; Mon, 11 Jul 2022 09:09:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B94C34115; Mon, 11 Jul 2022 09:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530597; bh=6sP7RL3xTS8nI1qeT7Pu8e+0tD2TtYrZtzMZePXEVaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZKFqocZgopyMoMoQAjityRGj0X8FPG7vFefg2FYJiDcrGZji2Mb3GmiRAufKdzZP F4bKHT6CScZ/yn+XnbxE93sZ584an4O5LvMgdWrN/fqsdjFnnReSxHKF4h6+0FFKMS jpzJeZHDURewUIA6U1fV1o3fYLQOnSYA44EyGiTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , Geert Uytterhoeven Subject: [PATCH 5.4 10/38] fbmem: Check virtual screen sizes in fb_set_var() Date: Mon, 11 Jul 2022 11:06:52 +0200 Message-Id: <20220711090539.031561621@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090538.722676354@linuxfoundation.org> References: <20220711090538.722676354@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 6c11df58fd1ac0aefcb3b227f72769272b939e56 upstream. Verify that the fbdev or drm driver correctly adjusted the virtual screen sizes. On failure report the failing driver and reject the screen size change. Signed-off-by: Helge Deller Reviewed-by: Geert Uytterhoeven Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1014,6 +1014,16 @@ fb_set_var(struct fb_info *info, struct if (ret) return ret; + /* verify that virtual resolution >= physical resolution */ + if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { + pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n", + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); + return -EINVAL; + } + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) return 0;