diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-12 18:41:22 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-12 18:41:22 +0000 |
commit | bce72aba44fc06f9485a2c002aebaa7fd92f58c9 (patch) | |
tree | a901de254a1adbbb79ca2af589bd871ea67cf9d7 /sys/compat/svr4 | |
parent | 10bd0832e038949eb0133f149a0bbe6f9501c17a (diff) |
More FREF/FRELE protection. This time all users of getvnode.
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index 99d911bdcf1..4eebd06f5af 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_misc.c,v 1.38 2001/11/28 13:47:39 art Exp $ */ +/* $OpenBSD: svr4_misc.c,v 1.39 2002/02/12 18:41:21 art Exp $ */ /* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ /* @@ -304,9 +304,12 @@ svr4_sys_getdents(p, v, retval) args.resid = SCARG(uap, nbytes); args.outp = (caddr_t)SCARG(uap, buf); - - if ((error = readdir_with_callback(fp, &fp->f_offset, SCARG(uap, nbytes), - svr4_readdir_callback, &args)) != 0) + + FREF(fp); + error = readdir_with_callback(fp, &fp->f_offset, SCARG(uap, nbytes), + svr4_readdir_callback, &args); + FRELE(fp); + if (error) return (error); *retval = SCARG(uap, nbytes) - args.resid; @@ -330,9 +333,12 @@ svr4_sys_getdents64(p, v, retval) args.resid = SCARG(uap, nbytes); args.outp = (caddr_t)SCARG(uap, dp); - - if ((error = readdir_with_callback(fp, &fp->f_offset, SCARG(uap, nbytes), + + FREF(fp); + error = readdir_with_callback(fp, &fp->f_offset, SCARG(uap, nbytes), svr4_readdir64_callback, &args)) != 0) + FRELE(fp); + if (error) return (error); *retval = SCARG(uap, nbytes) - args.resid; @@ -424,6 +430,7 @@ svr4_sys_fchroot(p, v, retval) return error; if ((error = getvnode(fdp, SCARG(uap, fd), &fp)) != 0) return error; + FREF(fp); vp = (struct vnode *) fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (vp->v_type != VDIR) @@ -431,12 +438,15 @@ svr4_sys_fchroot(p, v, retval) else error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - if (error) + if (error) { + FRELE(fp); return error; + } VREF(vp); if (fdp->fd_rdir != NULL) vrele(fdp->fd_rdir); fdp->fd_rdir = vp; + FRELE(fp); return 0; } |