diff options
author | George Kennedy <george.kennedy@oracle.com> | 2020-07-31 12:33:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-03 11:22:31 +0200 |
commit | 422ef2b827a9e7bc7d9eef8bb664ca297e80995d (patch) | |
tree | a9504798886f552dd89080afe9a48ef776859a31 /drivers/tty | |
parent | 47b7a50f8ace0b3b64c63dba61b5cd6099b670ed (diff) | |
download | linux-stable-422ef2b827a9e7bc7d9eef8bb664ca297e80995d.tar.gz linux-stable-422ef2b827a9e7bc7d9eef8bb664ca297e80995d.tar.bz2 linux-stable-422ef2b827a9e7bc7d9eef8bb664ca297e80995d.zip |
vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize()
commit bc5269ca765057a1b762e79a1cfd267cd7bf1c46 upstream.
vc_resize() can return with an error after failure. Change VT_RESIZEX ioctl
to save struct vc_data values that are modified and restore the original
values in case of error.
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
Cc: stable <stable@vger.kernel.org>
Reported-by: syzbot+38a3699c7eaf165b97a6@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/1596213192-6635-2-git-send-email-george.kennedy@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/vt/vt_ioctl.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 699ad55e3ec6..1184105b2a17 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -893,12 +893,22 @@ int vt_ioctl(struct tty_struct *tty, 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; - vc_resize(vcp, v.v_cols, v.v_rows); + 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(); } |