summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2008-08-28 15:23:18 +0000
committerattilio <attilio@FreeBSD.org>2008-08-28 15:23:18 +0000
commitdbf35e279f37ad4a573bf93923d141cb4a454c7d (patch)
tree61fe2ab5660fec327061e18eda0ed8c65276f262 /sys/fs/devfs
parentfb7f3b6363b61cead7eb5e94ac7f816358fc19ab (diff)
downloadFreeBSD-src-dbf35e279f37ad4a573bf93923d141cb4a454c7d.zip
FreeBSD-src-dbf35e279f37ad4a573bf93923d141cb4a454c7d.tar.gz
Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread
was always curthread and totally unuseful. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r--sys/fs/devfs/devfs_vnops.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 63ab7d4..d56e99b 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -1227,12 +1227,14 @@ devfs_setattr(struct vop_setattr_args *ap)
struct devfs_dirent *de;
struct vattr *vap;
struct vnode *vp;
+ struct thread *td;
int c, error;
uid_t uid;
gid_t gid;
vap = ap->a_vap;
vp = ap->a_vp;
+ td = curthread;
if ((vap->va_type != VNON) ||
(vap->va_nlink != VNOVAL) ||
(vap->va_fsid != VNOVAL) ||
@@ -1261,7 +1263,7 @@ devfs_setattr(struct vop_setattr_args *ap)
if (uid != de->de_uid || gid != de->de_gid) {
if ((ap->a_cred->cr_uid != de->de_uid) || uid != de->de_uid ||
(gid != de->de_gid && !groupmember(gid, ap->a_cred))) {
- error = priv_check(ap->a_td, PRIV_VFS_CHOWN);
+ error = priv_check(td, PRIV_VFS_CHOWN);
if (error)
return (error);
}
@@ -1272,7 +1274,7 @@ devfs_setattr(struct vop_setattr_args *ap)
if (vap->va_mode != (mode_t)VNOVAL) {
if (ap->a_cred->cr_uid != de->de_uid) {
- error = priv_check(ap->a_td, PRIV_VFS_ADMIN);
+ error = priv_check(td, PRIV_VFS_ADMIN);
if (error)
return (error);
}
@@ -1282,9 +1284,9 @@ devfs_setattr(struct vop_setattr_args *ap)
if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
/* See the comment in ufs_vnops::ufs_setattr(). */
- if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, ap->a_td)) &&
+ if ((error = VOP_ACCESS(vp, VADMIN, ap->a_cred, td)) &&
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
- (error = VOP_ACCESS(vp, VWRITE, ap->a_cred, ap->a_td))))
+ (error = VOP_ACCESS(vp, VWRITE, ap->a_cred, td))))
return (error);
if (vap->va_atime.tv_sec != VNOVAL) {
if (vp->v_type == VCHR)
OpenPOWER on IntegriCloud