Skip to contentSkip to conversation

x86/boot: Prevent faulty bootparams.screeninfo from causing harm

PATCH New Jan H. Schönherr 1 participant 1 message Aug 27, 2017 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 arch/x86/boot/compressed/misc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/boot/compressed/misc.c +1 -2
index a0838ab..c14217c 100644
@@ -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;
Signature · 1 line
2.3.1.dirty