Date: Mon, 1 Feb 2021 05:43:01 GMT From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b06fd805cc87 - stable/13 - tmpfs: push VEXEC check into tmpfs_lookup() Message-ID: <202102010543.1115h1xj051347@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b06fd805cc871cbde03d3ce8310adf09c9d581b4 commit b06fd805cc871cbde03d3ce8310adf09c9d581b4 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2021-01-28 14:27:28 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2021-02-01 05:42:30 +0000 tmpfs: push VEXEC check into tmpfs_lookup() vfs_cache_lookup() has already done the appropriate VEXEC check, therefore we must not re-check in VOP_CACHEDLOOKUP. This fixes O_SEARCH semantics on tmpfs and removes a redundant descent into VOP_ACCESS() in the common case. (cherry picked from commit 0f919ed4ae4df082eefb517afe02752b1790afd3) --- sys/fs/tmpfs/tmpfs_vnops.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 66568e07b4d7..f77692a10690 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -91,14 +91,10 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) struct tmpfs_mount *tm; int error; + /* Caller assumes responsibility for ensuring access (VEXEC). */ dnode = VP_TO_TMPFS_DIR(dvp); *vpp = NULLVP; - /* Check accessibility of requested node as a first step. */ - error = vn_dir_check_exec(dvp, cnp); - if (error != 0) - goto out; - /* We cannot be requesting the parent directory of the root node. */ MPASS(IMPLIES(dnode->tn_type == VDIR && dnode->tn_dir.tn_parent == dnode, @@ -241,8 +237,17 @@ tmpfs_cached_lookup(struct vop_cachedlookup_args *v) static int tmpfs_lookup(struct vop_lookup_args *v) { + struct vnode *dvp = v->a_dvp; + struct vnode **vpp = v->a_vpp; + struct componentname *cnp = v->a_cnp; + int error; - return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); + /* Check accessibility of requested node as a first step. */ + error = vn_dir_check_exec(dvp, cnp); + if (error != 0) + return (error); + + return (tmpfs_lookup1(dvp, vpp, cnp)); } static int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102010543.1115h1xj051347>