aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@FreeBSD.org>2021-02-21 10:32:18 +0000
committerToomas Soome <tsoome@FreeBSD.org>2021-02-21 10:45:36 +0000
commit61c50cbc096d28e44cb8b627e524ae58158c423a (patch)
tree7de2c477d217127c5296641a2f2f3c025743acd3
parentf11e9f325aee3459fee94f3a660a8e6c1a25c2ac (diff)
downloadsrc-61c50cbc096d28e44cb8b627e524ae58158c423a.tar.gz
src-61c50cbc096d28e44cb8b627e524ae58158c423a.zip
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. Reported by: Kamigishi Rei MFC after: 3 days
-rw-r--r--stand/efi/libefi/efi_console.c3
-rw-r--r--stand/i386/libi386/vidconsole.c8
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();
/*