Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3543214pxj; Mon, 24 May 2021 09:02:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvqJKvZsFUmmk5xIZSfz6YfsJguQ73mYi42yzRKNHu/vvm9Ps7Id6BGnrfcJT+jO+KsQHl X-Received: by 2002:a5d:9959:: with SMTP id v25mr16853871ios.85.1621872156368; Mon, 24 May 2021 09:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872156; cv=none; d=google.com; s=arc-20160816; b=XXs8gQ8nBu1Vdj3R0F0aE5SRcwC00p7VFE5O1gJG8CX1LiQlMDFMZVzCj2uVPdFScA bZeaATRn6G5yivjhAkcFH+DJM9gJDobSPSoXrBjpnz8cA6jXvnm/2BpSjfQHPD1XC5Dz mzyBsyTAZdcWKTmPvarZCdbm1xvhbzeN4kypYxPoqbYRsE+JOPhYEMh73GVzA+iJfGLR 5+baEsQAgicr+x/asTs40LaYNMBUWVYwCPISFbD+G92fGCrc+PaM/gywowpAmr0qkMzJ 7RH5he8ApgAm21T25u52AJR972GfBxCpXgVhEAufC0gIdHfa89bzmyBFTMzaRQGvU4MC wd3A== 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=Fp7+cjcJAfhLm0ZIgDs18EG5VDDEbU4mTF9TX0mRXiM=; b=p+opO68vxR1KbZLrFftW58UbhKErvVzMTMA+Ms8ORlOzaaMI9Vtg+6uiX/QxEBonxg pdH5X237Pyikgl/++qI+GtXBVHwzpjEknkfRVJY4HAcMnODqvd/bGiT48G2a5JvMffKg BW1JlVt2a0NPsCVLd7/sYcD0OO98UAtfzAFZYepcCYduKVDujMp3pbQq77Bgqdn5PwYq 1H5VEB5xgUEp17XdKY/ml38vvC11NPUJz30WrNbK8h5d66xzVh3cGmB+m1ESFb1/QMc9 mt5ir328wApz8dDkdvJuueg9UR4fcQmOvwliDq51XCCT4CsYllOdq6WAuYiT3toTCVih t1fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZFS6QyDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si494353ilr.133.2021.05.24.09.02.20; Mon, 24 May 2021 09:02:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZFS6QyDv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234767AbhEXQCH (ORCPT + 99 others); Mon, 24 May 2021 12:02:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234967AbhEXPzm (ORCPT ); Mon, 24 May 2021 11:55:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90A8461931; Mon, 24 May 2021 15:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870921; bh=etv7fgbCsQed6BsyYMNF77B1kOL4B+jWWd1yX1Ib1Fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZFS6QyDv+gy5CUw+0SuQtAe6xaDZT+LkC5y6uIEBDy2fq3e5qQkFJWddlAUZl6ZvK 3NqTxWiWl9qzJKIpmqqkLakrAU+dR2yPBD1o2dr2nm6FnnzeiyyvlF6W5JOGM0Cwye g+BpoqJ6PavkmFY5rHLUt/YebEV11QlqE9FeO3XA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Linus Torvalds Subject: [PATCH 5.10 096/104] vt_ioctl: Revert VT_RESIZEX parameter handling removal Date: Mon, 24 May 2021 17:26:31 +0200 Message-Id: <20210524152336.036709416@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maciej W. Rozycki commit a90c275eb144c1b755f04769e1f29d832d6daeaf upstream. Revert the removal of code handling extra VT_RESIZEX ioctl's parameters beyond those that VT_RESIZE supports, fixing a functional regression causing `svgatextmode' not to resize the VT anymore. As a consequence of the reverted change when the video adapter is reprogrammed from the original say 80x25 text mode using a 9x16 character cell (720x400 pixel resolution) to say 80x37 text mode and the same character cell (720x592 pixel resolution), the VT geometry does not get updated and only upper two thirds of the screen are used for the VT, and the lower part remains blank. The proportions change according to text mode geometries chosen. Revert the change verbatim then, bringing back previous VT resizing. Signed-off-by: Maciej W. Rozycki Fixes: 988d0763361b ("vt_ioctl: make VT_RESIZEX behave like VT_RESIZE") Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt_ioctl.c | 57 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 10 deletions(-) --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -771,21 +771,58 @@ static int vt_resizex(struct vc_data *vc if (copy_from_user(&v, cs, sizeof(struct vt_consize))) return -EFAULT; - if (v.v_vlin) - pr_info_once("\"struct vt_consize\"->v_vlin is ignored. Please report if you need this.\n"); - if (v.v_clin) - pr_info_once("\"struct vt_consize\"->v_clin is ignored. Please report if you need this.\n"); + /* FIXME: Should check the copies properly */ + if (!v.v_vlin) + v.v_vlin = vc->vc_scan_lines; + + if (v.v_clin) { + int rows = v.v_vlin / v.v_clin; + if (v.v_rows != rows) { + if (v.v_rows) /* Parameters don't add up */ + return -EINVAL; + v.v_rows = rows; + } + } + + if (v.v_vcol && v.v_ccol) { + int cols = v.v_vcol / v.v_ccol; + if (v.v_cols != cols) { + if (v.v_cols) + return -EINVAL; + v.v_cols = cols; + } + } + + if (v.v_clin > 32) + return -EINVAL; - console_lock(); for (i = 0; i < MAX_NR_CONSOLES; i++) { - vc = vc_cons[i].d; + struct vc_data *vcp; + + if (!vc_cons[i].d) + continue; + console_lock(); + vcp = vc_cons[i].d; + if (vcp) { + int ret; + int save_scan_lines = vcp->vc_scan_lines; + int save_font_height = vcp->vc_font.height; - if (vc) { - vc->vc_resize_user = 1; - vc_resize(vc, v.v_cols, v.v_rows); + if (v.v_vlin) + vcp->vc_scan_lines = v.v_vlin; + if (v.v_clin) + vcp->vc_font.height = v.v_clin; + vcp->vc_resize_user = 1; + ret = vc_resize(vcp, v.v_cols, v.v_rows); + if (ret) { + vcp->vc_scan_lines = save_scan_lines; + vcp->vc_font.height = save_font_height; + console_unlock(); + return ret; + } } + console_unlock(); } - console_unlock(); return 0; }