mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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]>
This commit is contained in:
parent
d704b2d32c
commit
32b2921e6a
1 changed files with 2 additions and 0 deletions
|
|
@ -870,6 +870,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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue