diff options
author | Toomas Soome <tsoome@FreeBSD.org> | 2021-01-24 18:59:36 +0000 |
---|---|---|
committer | Toomas Soome <tsoome@FreeBSD.org> | 2021-02-02 10:11:38 +0000 |
commit | b79f2bc6c5c7431fa1f7c02937ec97a64653ade1 (patch) | |
tree | 0aa11a4bb4c801d0bc00cb24eedd5e4143b57030 | |
parent | 0d381d1b92e5cc0a83f5fd6b4aa7f063d4d4f2c6 (diff) | |
download | src-b79f2bc6c5c7431fa1f7c02937ec97a64653ade1.tar.gz src-b79f2bc6c5c7431fa1f7c02937ec97a64653ade1.zip |
vt: panic while changing vt font
Set refcount for loader provided font to 1 to prevent this font
from being released (so we can reset to default).
As we get started with no memory allocator, we set up static font data
for font passed by loader (if there is any). At this time, we also must
set refcount 1, and refcount will get incremented in cnprobe() callback.
At some point the memory allocator will be available, and we will set up
properly allocated font data, but we should not disturb the refcount.
PR: 252833
PR: 253147
(cherry picked and squashed 93ebd6307efeb95a29bc614edd0c67c2af850e98 and
1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd)
-rw-r--r-- | sys/dev/vt/vt_core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 2352ed823424..05c383829f49 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -1487,6 +1487,8 @@ parse_font_info_static(struct font_info *fi) vfp = &vt_font_loader; vfp->vf_height = fi->fi_height; vfp->vf_width = fi->fi_width; + /* This is default font, set refcount 1 to disable removal. */ + vfp->vf_refcount = 1; for (unsigned i = 0; i < VFNT_MAPS; i++) { if (fi->fi_map_count[i] == 0) continue; @@ -1499,6 +1501,12 @@ parse_font_info_static(struct font_info *fi) return (vfp); } +/* + * Set up default font with allocated data structures. + * However, we can not set refcount here, because it is already set and + * incremented in vtterm_cnprobe() to avoid being released by font load from + * userland. + */ static struct vt_font * parse_font_info(struct font_info *fi) { |