Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Mar 2021 10:54:50 GMT
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 05e4a34e4360 - stable/13 - loader: autoload_font will hung loader when there is no local console
Message-ID:  <202103011054.121Aso2D088989@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tsoome:

URL: https://cgit.FreeBSD.org/src/commit/?id=05e4a34e4360f54ec62616730465410726c96ba2

commit 05e4a34e4360f54ec62616730465410726c96ba2
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-02-21 10:32:18 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2021-03-01 10:54:36 +0000

    loader: autoload_font will hung loader when there is no local console
    
    If we start with console set to comconsole, the local
    console (vidconsole, efi) is never initialized and attempt to
    use the data can render the loader hung.
    
    (cherry picked from commit 61c50cbc096d28e44cb8b627e524ae58158c423a)
    
    Reported by:    Kamigishi Rei
---
 stand/efi/libefi/efi_console.c  | 3 +++
 stand/i386/libi386/vidconsole.c | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c
index 7024f9c8b2f2..3cbd121c41da 100644
--- a/stand/efi/libefi/efi_console.c
+++ b/stand/efi/libefi/efi_console.c
@@ -886,6 +886,9 @@ cons_update_mode(bool use_gfx_mode)
 	EFI_STATUS status;
 	char env[10], *ptr;
 
+	if (!efi_started)
+		return (false);
+
 	/*
 	 * Despite the use_gfx_mode, we want to make sure we call
 	 * efi_find_framebuffer(). This will populate the fb data,
diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c
index f94ed2d26712..b933a7807687 100644
--- a/stand/i386/libi386/vidconsole.c
+++ b/stand/i386/libi386/vidconsole.c
@@ -53,7 +53,7 @@ static int	vidc_getchar(void);
 static int	vidc_ischar(void);
 static void	cons_draw_frame(teken_attr_t *);
 
-static int	vidc_started;
+static bool	vidc_started;
 static uint16_t	*vgatext;
 
 static tf_bell_t	vidc_cons_bell;
@@ -877,6 +877,10 @@ cons_update_mode(bool use_gfx_mode)
 	char env[10], *ptr;
 	int format, roff, goff, boff;
 
+	/* vidc_init() is not called yet. */
+	if (!vidc_started)
+		return (false);
+
 	gfx_state.tg_tp.tp_row = TEXT_ROWS;
 	gfx_state.tg_tp.tp_col = TEXT_COLS;
 
@@ -996,7 +1000,7 @@ vidc_init(int arg)
 	if (vidc_started && arg == 0)
 		return (0);
 
-	vidc_started = 1;
+	vidc_started = true;
 	vbe_init();
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103011054.121Aso2D088989>