Skip to content

Commit fb1cc2f

Browse files
schnhrrIngo Molnar
authored andcommitted
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 <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Kees Cook <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 5746f05 commit fb1cc2f

File tree

1 file changed

+1
-2
lines changed
  • arch/x86/boot/compressed

1 file changed

+1
-2
lines changed

arch/x86/boot/compressed/misc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ void __putstr(const char *s)
116116
}
117117
}
118118

119-
if (boot_params->screen_info.orig_video_mode == 0 &&
120-
lines == 0 && cols == 0)
119+
if (lines == 0 || cols == 0)
121120
return;
122121

123122
x = boot_params->screen_info.orig_x;

0 commit comments

Comments
 (0)