Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756304AbcJMRNK (ORCPT ); Thu, 13 Oct 2016 13:13:10 -0400 Received: from mx1.scotdoyle.com ([162.253.176.241]:46734 "EHLO mx1.scotdoyle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755478AbcJMRNI (ORCPT ); Thu, 13 Oct 2016 13:13:08 -0400 Date: Thu, 13 Oct 2016 12:12:43 -0500 (CDT) From: Scot Doyle To: Greg Kroah-Hartman cc: Jiri Slaby , Dmitry Vyukov , Peter Hurley , tomi.valkeinen@ti.com, jean-philippe.brucker@arm.com, "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH] vt: clear selection before resizing In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 793 Lines: 27 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 --- drivers/tty/vt/vt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 06fb39c..5d6a549 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -874,6 +874,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; -- 2.7.4