Merge tag 'tty-7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty fixes from Greg KH:
 "Here are two small tty vt fixes for 7.0-rc7 to resolve some reported
  issues with the resize ability of the alt screen buffer. Both of these
  have been in linux-next all week with no reported issues"

* tag 'tty-7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  vt: resize saved unicode buffer on alt screen exit after resize
  vt: discard stale unicode buffer on alt screen exit after resize
This commit is contained in:
Linus Torvalds
2026-04-05 10:04:28 -07:00

View File

@@ -1909,6 +1909,24 @@ static void leave_alt_screen(struct vc_data *vc)
dest = ((u16 *)vc->vc_origin) + r * vc->vc_cols;
memcpy(dest, src, 2 * cols);
}
/*
* If the console was resized while in the alternate screen,
* resize the saved unicode buffer to the current dimensions.
* On allocation failure new_uniscr is NULL, causing the old
* buffer to be freed and vc_uni_lines to be lazily rebuilt
* via vc_uniscr_check() when next needed.
*/
if (vc->vc_saved_uni_lines &&
(vc->vc_saved_rows != vc->vc_rows ||
vc->vc_saved_cols != vc->vc_cols)) {
u32 **new_uniscr = vc_uniscr_alloc(vc->vc_cols, vc->vc_rows);
if (new_uniscr)
vc_uniscr_copy_area(new_uniscr, vc->vc_cols, vc->vc_rows,
vc->vc_saved_uni_lines, cols, 0, rows);
vc_uniscr_free(vc->vc_saved_uni_lines);
vc->vc_saved_uni_lines = new_uniscr;
}
vc_uniscr_set(vc, vc->vc_saved_uni_lines);
vc->vc_saved_uni_lines = NULL;
restore_cur(vc);