Skip to content

Commit

Permalink
vgacon: Prevent faulty bootparams.screeninfo from causing harm
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
schnhrr authored and bzolnier committed Sep 4, 2017
1 parent 58ec01c commit b9a58de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/video/console/vgacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b9a58de

Please sign in to comment.