From: Jan H. Schönherr Date: Sun, 27 Aug 2017 18:23:43 +0000 (+0200) Subject: x86/boot: Prevent faulty bootparams.screeninfo from causing harm X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fb1cc2f91664fd8a2e454970480b5413725919f1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git x86/boot: Prevent faulty bootparams.screeninfo from causing harm If a zero for the number of lines manages to slip through, scroll() may underflow some offset calculations, causing accesses outside the video memory. Make the check in __putstr() more pessimistic to prevent that. Signed-off-by: Jan H. Schönherr Cc: H. Peter Anvin Cc: Kees Cook Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1503858223-14983-1-git-send-email-jschoenh@amazon.de Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index a0838ab929f2..c14217cd0155 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -116,8 +116,7 @@ void __putstr(const char *s) } } - if (boot_params->screen_info.orig_video_mode == 0 && - lines == 0 && cols == 0) + if (lines == 0 || cols == 0) return; x = boot_params->screen_info.orig_x;