[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211027005110.GA26354@djo.tudelft.nl>
Date: Wed, 27 Oct 2021 02:51:10 +0200
From: wim <wim@....tudelft.nl>
To: "Maciej W. Rozycki" <macro@...am.me.uk>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Pavel V. Panteleev" <panteleev_p@...t.ru>,
dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-kernel@...r.kernel.org, wim <wim@....tudelft.nl>
Subject: Re: [PATCH] vgacon: Propagate console boot parameters before calling
`vc_resize'
On Tue, Oct 26, 2021 at 12:26:22AM +0200, Maciej W. Rozycki wrote:
> Fix a division by zero in `vgacon_resize' with a backtrace like:
> ...
> linux-vt-vgacon-init-cell-height-fix.diff
> Index: linux-macro-ide-tty/drivers/video/console/vgacon.c
> ===================================================================
> --- linux-macro-ide-tty.orig/drivers/video/console/vgacon.c
> +++ linux-macro-ide-tty/drivers/video/console/vgacon.c
> @@ -366,11 +366,17 @@ static void vgacon_init(struct vc_data *
> struct uni_pagedir *p;
>
> /*
> - * We cannot be loaded as a module, therefore init is always 1,
> - * but vgacon_init can be called more than once, and init will
> - * not be 1.
> + * We cannot be loaded as a module, therefore init will be 1
> + * if we are the default console, however if we are a fallback
> + * console, for example if fbcon has failed registration, then
> + * init will be 0, so we need to make sure our boot parameters
> + * have been copied to the console structure for vgacon_resize
> + * ultimately called by vc_resize. Any subsequent calls to
> + * vgacon_init init will have init set to 0 too.
> */
> c->vc_can_do_color = vga_can_do_color;
> + c->vc_scan_lines = vga_scan_lines;
> + c->vc_font.height = c->vc_cell_height = vga_video_font_height;
>
> /* set dimensions manually if init != 0 since vc_resize() will fail */
> if (init) {
> @@ -379,8 +385,6 @@ static void vgacon_init(struct vc_data *
> } else
> vc_resize(c, vga_video_num_columns, vga_video_num_lines);
>
> - c->vc_scan_lines = vga_scan_lines;
> - c->vc_font.height = c->vc_cell_height = vga_video_font_height;
> c->vc_complement_mask = 0x7700;
> if (vga_512_chars)
> c->vc_hi_font_mask = 0x0800;
Just to let you know that the above patch fixes the crashes I experienced.
Tried in kernel 4.9.287.
The git tree is broken in the sense that it doesn't know the tags v4.9.284,
v4.9.285, v4.9.286 and v2.4.287.
Wim.
Powered by blists - more mailing lists