|
Thomas Zimmermann |
9480dc |
From 3dfac26e2ef29ff2abc2a75aa4cd48fce25a2c4b Mon Sep 17 00:00:00 2001
|
|
Thomas Zimmermann |
9480dc |
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
|
|
Thomas Zimmermann |
9480dc |
Date: Tue, 26 Oct 2021 00:26:22 +0200
|
|
Thomas Zimmermann |
9480dc |
Subject: vgacon: Propagate console boot parameters before calling `vc_resize'
|
|
Thomas Zimmermann |
9480dc |
Git-commit: 3dfac26e2ef29ff2abc2a75aa4cd48fce25a2c4b
|
|
Thomas Zimmermann |
9480dc |
Patch-mainline: v5.16-rc4
|
|
Thomas Zimmermann |
9480dc |
References: bsc#1152489
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
Fix a division by zero in `vgacon_resize' with a backtrace like:
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
vgacon_resize
|
|
Thomas Zimmermann |
9480dc |
vc_do_resize
|
|
Thomas Zimmermann |
9480dc |
vgacon_init
|
|
Thomas Zimmermann |
9480dc |
do_bind_con_driver
|
|
Thomas Zimmermann |
9480dc |
do_unbind_con_driver
|
|
Thomas Zimmermann |
9480dc |
fbcon_fb_unbind
|
|
Thomas Zimmermann |
9480dc |
do_unregister_framebuffer
|
|
Thomas Zimmermann |
9480dc |
do_register_framebuffer
|
|
Thomas Zimmermann |
9480dc |
register_framebuffer
|
|
Thomas Zimmermann |
9480dc |
__drm_fb_helper_initial_config_and_unlock
|
|
Thomas Zimmermann |
9480dc |
drm_helper_hpd_irq_event
|
|
Thomas Zimmermann |
9480dc |
dw_hdmi_irq
|
|
Thomas Zimmermann |
9480dc |
irq_thread
|
|
Thomas Zimmermann |
9480dc |
kthread
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
caused by `c->vc_cell_height' not having been initialized. This has
|
|
Thomas Zimmermann |
9480dc |
only started to trigger with commit 860dafa90259 ("vt: Fix character
|
|
Thomas Zimmermann |
9480dc |
height handling with VT_RESIZEX"), however the ultimate offender is
|
|
Thomas Zimmermann |
9480dc |
commit 50ec42edd978 ("[PATCH] Detaching fbcon: fix vgacon to allow
|
|
Thomas Zimmermann |
9480dc |
retaking of the console").
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
Said commit has added a call to `vc_resize' whenever `vgacon_init' is
|
|
Thomas Zimmermann |
9480dc |
called with the `init' argument set to 0, which did not happen before.
|
|
Thomas Zimmermann |
9480dc |
And the call is made before a key vgacon boot parameter retrieved in
|
|
Thomas Zimmermann |
9480dc |
`vgacon_startup' has been propagated in `vgacon_init' for `vc_resize' to
|
|
Thomas Zimmermann |
9480dc |
use to the console structure being worked on. Previously the parameter
|
|
Thomas Zimmermann |
9480dc |
was `c->vc_font.height' and now it is `c->vc_cell_height'.
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
In this particular scenario the registration of fbcon has failed and vt
|
|
Thomas Zimmermann |
9480dc |
resorts to vgacon. Now fbcon does have initialized `c->vc_font.height'
|
|
Thomas Zimmermann |
9480dc |
somehow, unlike `c->vc_cell_height', which is why this code did not
|
|
Thomas Zimmermann |
9480dc |
crash before, but either way the boot parameters should have been copied
|
|
Thomas Zimmermann |
9480dc |
to the console structure ahead of the call to `vc_resize' rather than
|
|
Thomas Zimmermann |
9480dc |
afterwards, so that first the call has a chance to use them and second
|
|
Thomas Zimmermann |
9480dc |
they do not change the console structure to something possibly different
|
|
Thomas Zimmermann |
9480dc |
from what was used by `vc_resize'.
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
Move the propagation of the vgacon boot parameters ahead of the call to
|
|
Thomas Zimmermann |
9480dc |
`vc_resize' then. Adjust the comment accordingly.
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
Fixes: 50ec42edd978 ("[PATCH] Detaching fbcon: fix vgacon to allow retaking of the console")
|
|
Thomas Zimmermann |
9480dc |
Cc: stable@vger.kernel.org # v2.6.18+
|
|
Thomas Zimmermann |
9480dc |
Reported-by: Wim Osterholt <wim@djo.tudelft.nl>
|
|
Thomas Zimmermann |
9480dc |
Reported-by: Pavel V. Panteleev <panteleev_p@mcst.ru>
|
|
Thomas Zimmermann |
9480dc |
Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
|
|
Thomas Zimmermann |
9480dc |
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2110252317110.58149@angie.orcam.me.uk
|
|
Thomas Zimmermann |
9480dc |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
Thomas Zimmermann |
9480dc |
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
|
|
Thomas Zimmermann |
9480dc |
---
|
|
Thomas Zimmermann |
9480dc |
drivers/video/console/vgacon.c | 10 +++++++---
|
|
Thomas Zimmermann |
9480dc |
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
--- a/drivers/video/console/vgacon.c
|
|
Thomas Zimmermann |
9480dc |
+++ b/drivers/video/console/vgacon.c
|
|
Thomas Zimmermann |
9480dc |
@@ -370,9 +370,13 @@ static void vgacon_init(struct vc_data *
|
|
Thomas Zimmermann |
9480dc |
struct uni_pagedir *p;
|
|
Thomas Zimmermann |
9480dc |
|
|
Thomas Zimmermann |
9480dc |
/*
|
|
Thomas Zimmermann |
9480dc |
- * We cannot be loaded as a module, therefore init is always 1,
|
|
Thomas Zimmermann |
9480dc |
- * but vgacon_init can be called more than once, and init will
|
|
Thomas Zimmermann |
9480dc |
- * not be 1.
|
|
Thomas Zimmermann |
9480dc |
+ * We cannot be loaded as a module, therefore init will be 1
|
|
Thomas Zimmermann |
9480dc |
+ * if we are the default console, however if we are a fallback
|
|
Thomas Zimmermann |
9480dc |
+ * console, for example if fbcon has failed registration, then
|
|
Thomas Zimmermann |
9480dc |
+ * init will be 0, so we need to make sure our boot parameters
|
|
Thomas Zimmermann |
9480dc |
+ * have been copied to the console structure for vgacon_resize
|
|
Thomas Zimmermann |
9480dc |
+ * ultimately called by vc_resize. Any subsequent calls to
|
|
Thomas Zimmermann |
9480dc |
+ * vgacon_init init will have init set to 0 too.
|
|
Thomas Zimmermann |
9480dc |
*/
|
|
Thomas Zimmermann |
9480dc |
c->vc_can_do_color = vga_can_do_color;
|
|
Thomas Zimmermann |
9480dc |
|