All of lore.kernel.org
 help / color / mirror / Atom feed
From: wim <wim@djo.tudelft.nl>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Pavel V. Panteleev" <panteleev_p@mcst.ru>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, wim <wim@djo.tudelft.nl>
Subject: Re: [PATCH] vgacon: Propagate console boot parameters before calling `vc_resize'
Date: Wed, 27 Oct 2021 02:51:10 +0200	[thread overview]
Message-ID: <20211027005110.GA26354@djo.tudelft.nl> (raw)
In-Reply-To: <alpine.DEB.2.21.2110252317110.58149@angie.orcam.me.uk>

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.

      reply	other threads:[~2021-10-27  0:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 22:26 [PATCH] vgacon: Propagate console boot parameters before calling `vc_resize' Maciej W. Rozycki
2021-10-27  0:51 ` wim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211027005110.GA26354@djo.tudelft.nl \
    --to=wim@djo.tudelft.nl \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=panteleev_p@mcst.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.