summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2022-06-25 12:56:49 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-12 16:30:47 +0200
commit4f34f380f952289e818c76617bbb5c9a3a9a9dd0 (patch)
tree572e403e31b4ab74415d68014dafb19472f27ae5
parent997d86cd3e39251f75c2302b538e74b4e8c9e8f7 (diff)
downloadlinux-4f34f380f952289e818c76617bbb5c9a3a9a9dd0.tar.gz
linux-4f34f380f952289e818c76617bbb5c9a3a9a9dd0.tar.bz2
linux-4f34f380f952289e818c76617bbb5c9a3a9a9dd0.zip
fbcon: Disallow setting font bigger than screen size
commit 65a01e601dbba8b7a51a2677811f70f783766682 upstream. Prevent that users set a font size which is bigger than the physical screen. It's unlikely this may happen (because screens are usually much larger than the fonts and each font char is limited to 32x32 pixels), but it may happen on smaller screens/LCD displays. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/video/fbdev/core/fbcon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 1decded4845f..4bc484ea1a14 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2490,6 +2490,11 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
if (charcount != 256 && charcount != 512)
return -EINVAL;
+ /* font bigger than screen resolution ? */
+ if (w > FBCON_SWAP(info->var.rotate, info->var.xres, info->var.yres) ||
+ h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
+ return -EINVAL;
+
/* Make sure drawing engine can handle the font */
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
!(info->pixmap.blit_y & (1 << (font->height - 1))))