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.

Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

authored by

Jan H. Schönherr and committed by
Bartlomiej Zolnierkiewicz
b9a58de5 58ec01ce

+2 -3
+2 -3
drivers/video/console/vgacon.c
··· 398 398 #endif 399 399 } 400 400 401 - /* boot_params.screen_info initialized? */ 402 - if ((screen_info.orig_video_mode == 0) && 403 - (screen_info.orig_video_lines == 0) && 401 + /* boot_params.screen_info reasonably initialized? */ 402 + if ((screen_info.orig_video_lines == 0) || 404 403 (screen_info.orig_video_cols == 0)) 405 404 goto no_vga; 406 405