vt: don't use kmalloc() for the unicode screen buffer
authorNicolas Pitre <nico@fluxnic.net>
Sun, 29 Mar 2020 02:25:11 +0000 (22:25 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2020 14:31:32 +0000 (16:31 +0200)
commitb91c4171c74e07fc0deeeba79e8a6ffbd052f841
treed9353cc8244c43c189cf6662de2a5bc67d484d8f
parent5a03e2be16de48536ca0396813bd0be4f24dfd0a
vt: don't use kmalloc() for the unicode screen buffer

commit 9a98e7a80f95378c9ee0c644705e3b5aa54745f1 upstream.

Even if the actual screen size is bounded in vc_do_resize(), the unicode
buffer is still a little more than twice the size of the glyph buffer
and may exceed MAX_ORDER down the kmalloc() path. This can be triggered
from user space.

Since there is no point having a physically contiguous buffer here,
let's avoid the above issue as well as reducing pressure on high order
allocations by using vmalloc() instead.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Cc: <stable@vger.kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://lore.kernel.org/r/nycvar.YSQ.7.76.2003282214210.2671@knanqh.ubzr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/vt.c