diff options
author | Jan H. Schönherr <[email protected]> | 2017-08-27 20:23:43 +0200 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2017-08-29 13:32:50 +0200 |
commit | fb1cc2f91664fd8a2e454970480b5413725919f1 (patch) | |
tree | fce72809a3f0b6248af9f98c0f98323163ef0b86 | |
parent | 5746f0555d00e1cbb7bc20a2fd09041ace6f350c (diff) |
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]>
-rw-r--r-- | arch/x86/boot/compressed/misc.c | 3 |
1 files changed, 1 insertions, 2 deletions
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; |