Skip to contentSkip to conversation

vgacon: Prevent faulty bootparams.screeninfo from causing harm

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

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vgacon: Prevent faulty bootparams.screeninfo from causing harm

If a zero for the number of colums or rows manages to slip through, gotoxy() will underflow vc->vc_pos, causing the next action on the referenced memory to end with a page fault.

Make the check in vgacon_startup() more pessimistic to prevent that.

---
 drivers/video/console/vgacon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/video/console/vgacon.c +2 -3
index dc06cb6..445b1dc 100644
@@ -398,9 +398,8 @@ static const char *vgacon_startup(void)
 #endif
 	}
 
-	/* boot_params.screen_info initialized? */
-	if ((screen_info.orig_video_mode  = 0) &&
-	    (screen_info.orig_video_lines = 0) &&
+	/* boot_params.screen_info reasonably initialized? */
+	if ((screen_info.orig_video_lines = 0) ||
 	    (screen_info.orig_video_cols  = 0))
 		goto no_vga;
 
Signature · 1 line
2.3.1.dirty