summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-03-05 23:15:23 +0000
committerrwatson <rwatson@FreeBSD.org>2003-03-05 23:15:23 +0000
commit3158a8710ade4d09a7a6763dceb8f57a09acfa9d (patch)
treec4a1fdc415a83d8034d95a499147b0faa77bc28c /sys
parentcd00a5e4714c42254f8039deac6b2106c10ea2ec (diff)
downloadFreeBSD-src-3158a8710ade4d09a7a6763dceb8f57a09acfa9d.zip
FreeBSD-src-3158a8710ade4d09a7a6763dceb8f57a09acfa9d.tar.gz
Move the initialization of the vattr flags field in setfflags() to
before the MAC check so that we pass the flags field into the MAC check properly initialized. This didn't affect any current MAC modules since they didn't care what the flags argument was (as they were primarily interested in the fact that it was a meta-data write, not the contents of the write), but would be relevant to future modules relying on that field. Submitted by: Mike Halderman <mrh@spawar.navy.mil> Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_extattr.c9
-rw-r--r--sys/kern/vfs_syscalls.c9
2 files changed, 6 insertions, 12 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 0592e97..6e8656b 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -1942,16 +1942,13 @@ setfflags(td, vp, flags)
return (error);
VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ VATTR_NULL(&vattr);
+ vattr.va_flags = flags;
#ifdef MAC
error = mac_check_vnode_setflags(td->td_ucred, vp, vattr.va_flags);
- if (error == 0) {
+ if (error == 0)
#endif
- VATTR_NULL(&vattr);
- vattr.va_flags = flags;
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
-#ifdef MAC
- }
-#endif
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 0592e97..6e8656b 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1942,16 +1942,13 @@ setfflags(td, vp, flags)
return (error);
VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ VATTR_NULL(&vattr);
+ vattr.va_flags = flags;
#ifdef MAC
error = mac_check_vnode_setflags(td->td_ucred, vp, vattr.va_flags);
- if (error == 0) {
+ if (error == 0)
#endif
- VATTR_NULL(&vattr);
- vattr.va_flags = flags;
error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
-#ifdef MAC
- }
-#endif
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
OpenPOWER on IntegriCloud