diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-03-05 23:15:23 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-03-05 23:15:23 +0000 |
commit | 3158a8710ade4d09a7a6763dceb8f57a09acfa9d (patch) | |
tree | c4a1fdc415a83d8034d95a499147b0faa77bc28c /sys/kern/vfs_extattr.c | |
parent | cd00a5e4714c42254f8039deac6b2106c10ea2ec (diff) | |
download | FreeBSD-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/kern/vfs_extattr.c')
-rw-r--r-- | sys/kern/vfs_extattr.c | 9 |
1 files changed, 3 insertions, 6 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); |