From: Jan H. Schönherr Date: Mon, 4 Sep 2017 14:00:50 +0000 (+0200) Subject: vgacon: Prevent faulty bootparams.screeninfo from causing harm X-Git-Tag: v4.14-rc1~25^2~5 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b9a58de545858ac9ee67745cdea6d94cc322938e;p=linux-block.git 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 Cc: Greg Kroah-Hartman Cc: Jiri Slaby Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index dc06cb6a15dc..445b1dc5d441 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -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;