Skip to content

Commit

Permalink
vt: clear selection before resizing
Browse files Browse the repository at this point in the history
commit 009e39a upstream.

When resizing a vt its selection may exceed the new size, resulting in
an invalid memory access [1]. Clear the selection before resizing.

[1] http://lkml.kernel.org/r/CACT4Y+acDTwy4umEvf5ROBGiRJNrxHN4Cn5szCXE5Jw-d1B=Xw@mail.gmail.com

Reported-and-tested-by: Dmitry Vyukov <[email protected]>
Signed-off-by: Scot Doyle <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Scot Doyle authored and gregkh committed Nov 10, 2016
1 parent dc1555e commit 3425e39
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/tty/vt/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,9 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
if (!newscreen)
return -ENOMEM;

if (vc == sel_cons)
clear_selection();

old_rows = vc->vc_rows;
old_row_size = vc->vc_size_row;

Expand Down

0 comments on commit 3425e39

Please sign in to comment.