summaryrefslogtreecommitdiff
path: root/sys/miscfs/fdesc
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-02-12 18:41:22 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-02-12 18:41:22 +0000
commitbce72aba44fc06f9485a2c002aebaa7fd92f58c9 (patch)
treea901de254a1adbbb79ca2af589bd871ea67cf9d7 /sys/miscfs/fdesc
parent10bd0832e038949eb0133f149a0bbe6f9501c17a (diff)
More FREF/FRELE protection. This time all users of getvnode.
Diffstat (limited to 'sys/miscfs/fdesc')
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index 632fc28bd74..b120fe7da96 100644
--- a/sys/miscfs/fdesc/fdesc_vnops.c
+++ b/sys/miscfs/fdesc/fdesc_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdesc_vnops.c,v 1.28 2002/02/02 16:05:58 art Exp $ */
+/* $OpenBSD: fdesc_vnops.c,v 1.29 2002/02/12 18:41:21 art Exp $ */
/* $NetBSD: fdesc_vnops.c,v 1.32 1996/04/11 11:24:29 mrg Exp $ */
/*
@@ -568,17 +568,24 @@ fdesc_setattr(v)
}
return (error);
}
+ FREF(fp);
vp = (struct vnode *)fp->f_data;
- if (vp->v_mount->mnt_flag & MNT_RDONLY)
- return (EROFS);
+ if (vp->v_mount->mnt_flag & MNT_RDONLY) {
+ error = EROFS;
+ goto out;
+ }
/*
* Directories can cause deadlocks.
*/
- if (vp->v_type == VDIR)
- return (EOPNOTSUPP);
+ if (vp->v_type == VDIR) {
+ error = EOPNOTSUPP;
+ goto out;
+ }
vn_lock(vp, LK_EXCLUSIVE|LK_RETRY, p);
error = VOP_SETATTR(vp, vap, ap->a_cred, p);
VOP_UNLOCK(vp, 0, p);
+out:
+ FRELE(fp);
return (error);
}