git: 45ecb858242e - stable/13 - fdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Jun 2022 19:29:27 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=45ecb858242ee5875e0c732aeaaf2b9f35b08fcb
commit 45ecb858242ee5875e0c732aeaaf2b9f35b08fcb
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-06-05 18:49:09 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-13 19:29:23 +0000
fdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH
(cherry picked from commit 156745b42d9e6dfa3d9c6dc480db7836683850cf)
---
sys/fs/fdescfs/fdesc_vnops.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index c5a7b86f1de5..087f9b2551d1 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -504,9 +504,15 @@ fdesc_setattr(struct vop_setattr_args *ap)
/*
* Allow setattr where there is an underlying vnode.
+ * For O_PATH descriptors, disallow truncate.
*/
- error = getvnode(td, fd,
- cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp);
+ if (vap->va_size != VNOVAL) {
+ error = getvnode(td, fd,
+ cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp);
+ } else {
+ error = getvnode_path(td, fd,
+ cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp);
+ }
if (error) {
/*
* getvnode() returns EINVAL if the file descriptor is not