Skip to content

Commit 32b2921

Browse files
dvyukovgregkh
authored andcommitted
tty: limit terminal size to 4M chars
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 <[email protected]> CC: David Rientjes <[email protected]> Cc: One Thousand Gnomes <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Peter Hurley <[email protected]> Cc: [email protected] Cc: [email protected] Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d704b2d commit 32b2921

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/vt/vt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,8 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
870870
if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
871871
return 0;
872872

873+
if (new_screen_size > (4 << 20))
874+
return -EINVAL;
873875
newscreen = kmalloc(new_screen_size, GFP_USER);
874876
if (!newscreen)
875877
return -ENOMEM;

0 commit comments

Comments
 (0)