linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vgacon: Prevent faulty bootparams.screeninfo from causing harm
@ 2017-08-27 18:23 Jan H. Schönherr
  0 siblings, 0 replies; 2+ messages in thread
From: Jan H. Schönherr @ 2017-08-27 18:23 UTC (permalink / raw)
  To: linux-fbdev

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>
---
 drivers/video/console/vgacon.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index dc06cb6..445b1dc 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;
 
-- 
2.3.1.dirty


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] vgacon: Prevent faulty bootparams.screeninfo from causing harm
@ 2017-09-04 13:30 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-09-04 13:30 UTC (permalink / raw)
  To: linux-fbdev

On Sunday, August 27, 2017 08:23:29 PM Jan H. Schönherr wrote:
> 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>

Patch queued for 4.14, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-04 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 13:30 [PATCH] vgacon: Prevent faulty bootparams.screeninfo from causing harm Bartlomiej Zolnierkiewicz
  -- strict thread matches above, loose matches on Subject: below --
2017-08-27 18:23 Jan H. Schönherr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).