git: cbac1f346495 - main - Fix pjfstest issue tests/rename/09.t
Date: Sat, 11 Feb 2023 07:04:11 UTC
The branch main has been updated by fsu:
URL: https://cgit.FreeBSD.org/src/commit/?id=cbac1f3464956185cf95955344b6009e2cc3ae40
commit cbac1f3464956185cf95955344b6009e2cc3ae40
Author: Fedor Uporov <fsu@FreeBSD.org>
AuthorDate: 2023-02-02 10:13:02 +0000
Commit: Fedor Uporov <fsu@FreeBSD.org>
CommitDate: 2023-02-11 07:01:16 +0000
Fix pjfstest issue tests/rename/09.t
Fix rename when renamed directory not owned by user,
but when user owns the sticky parent directory.
Reviewed by: kib
MFC after: 2 week
Differential revision: https://reviews.freebsd.org/D38245
---
sys/fs/tmpfs/tmpfs_vnops.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 55f0beebc848..28de8c989487 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -1129,6 +1129,13 @@ tmpfs_rename(struct vop_rename_args *v)
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