aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScot Doyle <lkml14@scotdoyle.com>2016-10-13 12:12:43 -0500
committerSasha Levin <alexander.levin@verizon.com>2016-11-23 22:49:36 -0500
commit0b2a0a58ad22f9d6dfc641bc5ec46057493f22a5 (patch)
tree2e45930b93cc583dae467785f21e392fa7433b40
parent78ad6d4ce21be9409c0c5d8ddb9e3833819ee421 (diff)
downloadlinux-linaro-stable-0b2a0a58ad22f9d6dfc641bc5ec46057493f22a5.tar.gz
vt: clear selection before resizing
[ Upstream commit 009e39ae44f4191188aeb6dfbf661b771dbbe515 ] 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 <dvyukov@google.com> Signed-off-by: Scot Doyle <lkml14@scotdoyle.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-rw-r--r--drivers/tty/vt/vt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 8a6930bb1a01..1a049e4de937 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -869,6 +869,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;