Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4959256pxj; Wed, 12 May 2021 17:46:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQRaunUjOLsXEw4JNN3ysxkW+H1WCW2TzS0NEZWj1S1k6/RhVFwSBL7DmIino2VrdDNYhg X-Received: by 2002:a17:907:33c5:: with SMTP id zk5mr12450282ejb.499.1620866817130; Wed, 12 May 2021 17:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620866817; cv=none; d=google.com; s=arc-20160816; b=rGwhMiahuEQtTZVFXxiUE/xF+HvW+tQcf4d+3tQFsbdere7NSizYjHYVdTBY61Y/5Y hLhUWmaNMcKoKav1/hJyLUptCZUX2BMBoYdMaPhef87W24HJkE47QQH87LLNBPFBlbQA ubZW42azZp+QCH8//Hn2zzGUdRxw6C0DZCclMvOfNniPg3Ys7F1W732Wsixl66dWLpE9 ik+R/KeyqItQa0cK3ZaPo5mpNsP/ay2o0hq/idZ0ygVgw1QVKJTRL5/cb4DDFRmQw06u yjBcJ4XSWoJUGpuWhlWCBWemzY1/GUdxVDtC1PdnD/5FYcJ07OhGTwwVPTelSZJspDYO Ke7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=O3Ox+f98ZmADkDIEitdijb/p6AVJc0kt3X5l4XNLyEQ=; b=Pv4MCZvZuPS3rZG7Er4oEPwqWHlK/wig3UZXkn8kbE7NgE44uKSdSEyxrmGCiDvhz5 /u+0WsYwFu0XzNVZxVOkKOmGMG5DRGiDMov9ER0iiGiBH98jP6eRlqP+rBMcSrR0Jzsb AsSa8T2jPply+nE6pjmcvAapCGe50ZPmovFVYchqJwRiAVhVQUN2PLzkC7s0CPZcaV+l SSXdQT+aFOYeJDQPFhsaHF7ciOr4lGOfoYPFpCzcEPrUuRJMb0OoGqQjSAizwDoxD0YG 0UqDZDuIapornzuHb4MrpafDkqn3SyZOxglSziFIK6u/EdvNB0nrsn4yZ/AEZdUuDUvS lfkw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si1311432edq.89.2021.05.12.17.46.33; Wed, 12 May 2021 17:46:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232177AbhEMAmL (ORCPT + 99 others); Wed, 12 May 2021 20:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbhEMAjq (ORCPT ); Wed, 12 May 2021 20:39:46 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13691C06134E; Wed, 12 May 2021 17:37:28 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 6BE939200B4; Thu, 13 May 2021 02:37:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 5C71A9200B3; Thu, 13 May 2021 02:37:27 +0200 (CEST) Date: Thu, 13 May 2021 02:37:27 +0200 (CEST) From: "Maciej W. Rozycki" To: Greg Kroah-Hartman , Jiri Slaby cc: Linus Torvalds , Tetsuo Handa , Daniel Vetter , Martin Hostettler , Peilin Ye , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] vt_ioctl: Revert VT_RESIZEX parameter handling removal In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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+ --- drivers/tty/vt/vt_ioctl.c | 57 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 10 deletions(-) Index: linux-macro-ide/drivers/tty/vt/vt_ioctl.c =================================================================== --- linux-macro-ide.orig/drivers/tty/vt/vt_ioctl.c +++ linux-macro-ide/drivers/tty/vt/vt_ioctl.c @@ -671,21 +671,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) { - vc->vc_resize_user = 1; - vc_resize(vc, v.v_cols, v.v_rows); + 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 (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; }