Skip to content

Commit

Permalink
x86/boot: Prevent faulty bootparams.screeninfo from causing harm
Browse files Browse the repository at this point in the history
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 <jschoenh@amazon.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1503858223-14983-1-git-send-email-jschoenh@amazon.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Jan H. Schönherr authored and Ingo Molnar committed Aug 29, 2017
1 parent 5746f05 commit fb1cc2f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/x86/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fb1cc2f

Please sign in to comment.