From owner-dev-commits-src-all@freebsd.org Mon Feb 1 22:34:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3D8D4E9E84; Mon, 1 Feb 2021 22:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DV2n75dwMz3Lt5; Mon, 1 Feb 2021 22:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0195234DF; Mon, 1 Feb 2021 22:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 111MYZg0070811; Mon, 1 Feb 2021 22:34:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 111MYZ2A070810; Mon, 1 Feb 2021 22:34:35 GMT (envelope-from git) Date: Mon, 1 Feb 2021 22:34:35 GMT Message-Id: <202102012234.111MYZ2A070810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 1912d2b15e6d - main - vt: parse_font_info_static should set refcount, not parse_font_info MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 22:34:35 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd commit 1912d2b15e6d6f4a1d8c3886b03ab30d2f21f3fd Author: Toomas Soome AuthorDate: 2021-01-31 21:04:59 +0000 Commit: Toomas Soome CommitDate: 2021-02-01 22:33:58 +0000 vt: parse_font_info_static should set refcount, not parse_font_info 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: 253147 --- sys/dev/vt/vt_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index ac89d8635e78..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) { @@ -1528,8 +1536,6 @@ parse_font_info(struct font_info *fi) ptr = roundup2(ptr, 8); vfp = &vt_font_loader; - /* This is default font, set refcount 1 to disable removal. */ - vfp->vf_refcount = 1; vfp->vf_height = fi->fi_height; vfp->vf_width = fi->fi_width; for (unsigned i = 0; i < VFNT_MAPS; i++) {