From: Scot Doyle Date: Thu, 13 Oct 2016 17:12:43 +0000 (-0500) Subject: vt: clear selection before resizing X-Git-Tag: v3.2.85~65 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=commitdiff_plain;h=e60f8fcce05042e8f8cea25ee81fecc1222114cf;ds=sidebyside vt: clear selection before resizing commit 009e39ae44f4191188aeb6dfbf661b771dbbe515 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 Signed-off-by: Scot Doyle Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 9dc1e2be9d13..1c469ad1e0f6 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -888,6 +888,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;