linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch added to 3.12-stable] tty: limit terminal size to 4M chars
       [not found] <20161122224029.29962-1-jslaby@suse.cz>
@ 2016-11-22 22:40 ` Jiri Slaby
  0 siblings, 0 replies; only message in thread
From: Jiri Slaby @ 2016-11-22 22:40 UTC (permalink / raw)
  To: stable
  Cc: Dmitry Vyukov, David Rientjes, One Thousand Gnomes,
	Greg Kroah-Hartman, Jiri Slaby, Peter Hurley, linux-kernel,
	syzkaller, Jiri Slaby

From: Dmitry Vyukov <dvyukov@google.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 32b2921e6a7461fe63b71217067a6cf4bddb132f upstream.

Size of kmalloc() in vc_do_resize() is controlled by user.
Too large kmalloc() size triggers WARNING message on console.
Put a reasonable upper bound on terminal size to prevent WARNINGs.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
CC: David Rientjes <rientjes@google.com>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: linux-kernel@vger.kernel.org
Cc: syzkaller@googlegroups.com
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/vt/vt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index d52e653076f4..60ce423c6364 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -863,6 +863,8 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
 	if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
 		return 0;
 
+	if (new_screen_size > (4 << 20))
+		return -EINVAL;
 	newscreen = kmalloc(new_screen_size, GFP_USER);
 	if (!newscreen)
 		return -ENOMEM;
-- 
2.10.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-22 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20161122224029.29962-1-jslaby@suse.cz>
2016-11-22 22:40 ` [patch added to 3.12-stable] tty: limit terminal size to 4M chars Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).