diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1129,6 +1129,13 @@ if (de->td_node->tn_type == VDIR) { struct tmpfs_node *n; + error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread); + if (error) { + if (newname != NULL) + free(newname, M_TMPFSNAME); + goto out_locked; + } + /* * Ensure the target directory is not a child of the * directory being moved. Otherwise, we'd end up