mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
vt_ioctl: Revert VT_RESIZEX parameter handling removal
commita90c275eb1
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 <macro@orcam.me.uk> Fixes:988d076336
("vt_ioctl: make VT_RESIZEX behave like VT_RESIZE") Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a3de46844f
commit
8026eb8242
1 changed files with 49 additions and 12 deletions
|
@ -771,21 +771,58 @@ static int vt_resizex(struct vc_data *vc, struct vt_consize __user *cs)
|
|||
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;
|
||||
|
||||
console_lock();
|
||||
for (i = 0; i < MAX_NR_CONSOLES; i++) {
|
||||
vc = vc_cons[i].d;
|
||||
|
||||
if (vc) {
|
||||
vc->vc_resize_user = 1;
|
||||
vc_resize(vc, v.v_cols, v.v_rows);
|
||||
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;
|
||||
}
|
||||
}
|
||||
console_unlock();
|
||||
|
||||
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;
|
||||
|
||||
for (i = 0; i < MAX_NR_CONSOLES; i++) {
|
||||
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 (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();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue