From owner-svn-src-head@freebsd.org Fri Feb 21 01:39:52 2020 Return-Path: Delivered-To: svn-src-head@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 D36FA24D01D; Fri, 21 Feb 2020 01:39:52 +0000 (UTC) (envelope-from mjg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48NvK41kYgz3Hrf; Fri, 21 Feb 2020 01:39:52 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C26BE30C4; Fri, 21 Feb 2020 01:39:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01L1dpc7059065; Fri, 21 Feb 2020 01:39:51 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01L1dpW2059064; Fri, 21 Feb 2020 01:39:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202002210139.01L1dpW2059064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 21 Feb 2020 01:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358189 - head/sys/security/audit X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/security/audit X-SVN-Commit-Revision: 358189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2020 01:39:53 -0000 Author: mjg Date: Fri Feb 21 01:39:51 2020 New Revision: 358189 URL: https://svnweb.freebsd.org/changeset/base/358189 Log: audit: rely on use count instead of hold count in audit_canon_path Modified: head/sys/security/audit/audit_bsm_klib.c Modified: head/sys/security/audit/audit_bsm_klib.c ============================================================================== --- head/sys/security/audit/audit_bsm_klib.c Fri Feb 21 00:33:21 2020 (r358188) +++ head/sys/security/audit/audit_bsm_klib.c Fri Feb 21 01:39:51 2020 (r358189) @@ -443,7 +443,7 @@ audit_canon_path(struct thread *td, int dirfd, char *p */ if (fdp->fd_rdir != NULL && fdp->fd_rdir != rootvnode) { rvnp = fdp->fd_rdir; - vhold(rvnp); + vrefact(rvnp); } /* * If the supplied path is relative, make sure we capture the current @@ -453,19 +453,16 @@ audit_canon_path(struct thread *td, int dirfd, char *p if (*path != '/') { if (dirfd == AT_FDCWD) { cvnp = fdp->fd_cdir; - vhold(cvnp); + vrefact(cvnp); } else { - /* XXX: fgetvp() that vhold()s vnode instead of vref()ing it would be better */ error = fgetvp(td, dirfd, cap_rights_init(&rights), &cvnp); if (error) { FILEDESC_SUNLOCK(fdp); cpath[0] = '\0'; if (rvnp != NULL) - vdrop(rvnp); + vrele(rvnp); return; } - vhold(cvnp); - vrele(cvnp); } needslash = (fdp->fd_rdir != cvnp); } else { @@ -492,11 +489,11 @@ audit_canon_path(struct thread *td, int dirfd, char *p */ if (rvnp != NULL) { error = vn_fullpath_global(td, rvnp, &rbuf, &fbuf); - vdrop(rvnp); + vrele(rvnp); if (error) { cpath[0] = '\0'; if (cvnp != NULL) - vdrop(cvnp); + vrele(cvnp); return; } (void) sbuf_cat(&sbf, rbuf); @@ -504,7 +501,7 @@ audit_canon_path(struct thread *td, int dirfd, char *p } if (cvnp != NULL) { error = vn_fullpath(td, cvnp, &rbuf, &fbuf); - vdrop(cvnp); + vrele(cvnp); if (error) { cpath[0] = '\0'; return;