Skip to content

Commit 009e39a

Browse files
Scot Doylegregkh
authored andcommitted
vt: clear selection before resizing
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]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 03842c1 commit 009e39a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/tty/vt/vt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
876876
if (!newscreen)
877877
return -ENOMEM;
878878

879+
if (vc == sel_cons)
880+
clear_selection();
881+
879882
old_rows = vc->vc_rows;
880883
old_row_size = vc->vc_size_row;
881884

0 commit comments

Comments
 (0)