Date: Fri, 21 Feb 2020 01:39:51 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358189 - head/sys/security/audit Message-ID: <202002210139.01L1dpW2059064@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002210139.01L1dpW2059064>