diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-12 13:05:33 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-12 13:05:33 +0000 |
commit | 8b08ca52ce00cfd942606cbd6b616b85ca682d3f (patch) | |
tree | 7ee8adff016b64c02b113fe28bd2af5bd879580e | |
parent | 73693552d13e63640043dc3768acb73e9cddb534 (diff) |
Fix all users of getsock to use FREF/FRELE properly.
-rw-r--r-- | sys/compat/hpux/hpux_net.c | 24 | ||||
-rw-r--r-- | sys/compat/sunos/sunos_misc.c | 18 | ||||
-rw-r--r-- | sys/compat/ultrix/ultrix_misc.c | 16 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 161 | ||||
-rw-r--r-- | sys/miscfs/portal/portal_vfsops.c | 12 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 8 |
6 files changed, 157 insertions, 82 deletions
diff --git a/sys/compat/hpux/hpux_net.c b/sys/compat/hpux/hpux_net.c index 12a399e91c2..96d3d020be4 100644 --- a/sys/compat/hpux/hpux_net.c +++ b/sys/compat/hpux/hpux_net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hpux_net.c,v 1.6 2001/08/26 06:25:10 deraadt Exp $ */ +/* $OpenBSD: hpux_net.c,v 1.7 2002/02/12 13:05:31 art Exp $ */ /* $NetBSD: hpux_net.c,v 1.14 1997/04/01 19:59:02 scottr Exp $ */ /* @@ -216,10 +216,12 @@ hpux_sys_setsockopt(p, v, retval) return (error); if (SCARG(uap, valsize) > MLEN) return (EINVAL); + FREF(fp); if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t), (u_int)SCARG(uap, valsize)))) { + FRELE(fp); (void) m_free(m); return (error); } @@ -236,8 +238,10 @@ hpux_sys_setsockopt(p, v, retval) mtod(m, struct linger *)->l_onoff = 0; m->m_len = sizeof(struct linger); } - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), - SCARG(uap, name), m)); + error = sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), m); + FRELE(fp); + return (error); } /* ARGSUSED */ @@ -256,17 +260,21 @@ hpux_sys_setsockopt2(p, v, retval) return (error); if (SCARG(uap, valsize) > MLEN) return (EINVAL); + FREF(fp); if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t), (u_int)SCARG(uap, valsize)))) { + FRELE(fp); (void) m_free(m); return (error); } socksetsize(SCARG(uap, valsize), m); } - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), - SCARG(uap, name), m)); + error = sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), m); + FRELE(fp); + return (error); } int @@ -282,10 +290,13 @@ hpux_sys_getsockopt(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp))) return (error); + FREF(fp); if (SCARG(uap, val)) { if ((error = copyin((caddr_t)SCARG(uap, avalsize), - (caddr_t)&valsize, sizeof (valsize)))) + (caddr_t)&valsize, sizeof (valsize)))) { + FRELE(fp); return (error); + } } else valsize = 0; if ((error = sogetopt((struct socket *)fp->f_data, SCARG(uap, level), @@ -308,6 +319,7 @@ hpux_sys_getsockopt(p, v, retval) (caddr_t)SCARG(uap, avalsize), sizeof (valsize)); } bad: + FRELE(fp); if (m != NULL) (void) m_free(m); return (error); diff --git a/sys/compat/sunos/sunos_misc.c b/sys/compat/sunos/sunos_misc.c index 685803ead25..d3a4371c7f4 100644 --- a/sys/compat/sunos/sunos_misc.c +++ b/sys/compat/sunos/sunos_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunos_misc.c,v 1.31 2002/02/02 16:05:58 art Exp $ */ +/* $OpenBSD: sunos_misc.c,v 1.32 2002/02/12 13:05:31 art Exp $ */ /* $NetBSD: sunos_misc.c,v 1.65 1996/04/22 01:44:31 christos Exp $ */ /* @@ -519,20 +519,23 @@ sunos_sys_setsockopt(p, v, retval) void *v; register_t *retval; { - register struct sunos_sys_setsockopt_args *uap = v; + struct sunos_sys_setsockopt_args *uap = v; struct file *fp; struct mbuf *m = NULL; int error; if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); + FREF(fp); #define SO_DONTLINGER (~SO_LINGER) if (SCARG(uap, name) == SO_DONTLINGER) { m = m_get(M_WAIT, MT_SOOPTS); mtod(m, struct linger *)->l_onoff = 0; m->m_len = sizeof(struct linger); - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + error = (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), SO_LINGER, m)); + FRELE(fp); + return (error); } if (SCARG(uap, level) == IPPROTO_IP) { #define SUNOS_IP_MULTICAST_IF 2 @@ -553,20 +556,25 @@ sunos_sys_setsockopt(p, v, retval) ipoptxlat[SCARG(uap, name) - SUNOS_IP_MULTICAST_IF]; } } - if (SCARG(uap, valsize) > MLEN) + if (SCARG(uap, valsize) > MLEN) { + FRELE(fp); return (EINVAL); + } if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); error = copyin(SCARG(uap, val), mtod(m, caddr_t), (u_int)SCARG(uap, valsize)); if (error) { + FRELE(fp); (void) m_free(m); return (error); } m->m_len = SCARG(uap, valsize); } - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + error = (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), SCARG(uap, name), m)); + FRELE(fp); + return (error); } int diff --git a/sys/compat/ultrix/ultrix_misc.c b/sys/compat/ultrix/ultrix_misc.c index c84f4dbed79..8e46acd843f 100644 --- a/sys/compat/ultrix/ultrix_misc.c +++ b/sys/compat/ultrix/ultrix_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ultrix_misc.c,v 1.22 2001/11/06 19:53:18 miod Exp $ */ +/* $OpenBSD: ultrix_misc.c,v 1.23 2002/02/12 13:05:31 art Exp $ */ /* $NetBSD: ultrix_misc.c,v 1.23 1996/04/07 17:23:04 jonathan Exp $ */ /* @@ -353,27 +353,35 @@ ultrix_sys_setsockopt(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); + FREF(fp); #define SO_DONTLINGER (~SO_LINGER) if (SCARG(uap, name) == SO_DONTLINGER) { m = m_get(M_WAIT, MT_SOOPTS); mtod(m, struct linger *)->l_onoff = 0; m->m_len = sizeof(struct linger); - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + error = (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), SO_LINGER, m)); + FRELE(fp); + return (error); } - if (SCARG(uap, valsize) > MLEN) + if (SCARG(uap, valsize) > MLEN) { + FRELE(fp); return (EINVAL); + } if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t), (u_int)SCARG(uap, valsize))) != 0) { + FRELE(fp); (void) m_free(m); return (error); } m->m_len = SCARG(uap, valsize); } - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + error = (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), SCARG(uap, name), m)); + FRELE(fp); + return (error); } struct ultrix_utsname { diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 7d314949914..79ff605d430 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.49 2002/02/11 12:34:30 art Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.50 2002/02/12 13:05:31 art Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -115,12 +115,14 @@ sys_bind(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); + FREF(fp); error = sockargs(&nam, (caddr_t)SCARG(uap, name), SCARG(uap, namelen), MT_SONAME); - if (error) - return (error); - error = sobind((struct socket *)fp->f_data, nam); - m_freem(nam); + if (error == 0) { + error = sobind((struct socket *)fp->f_data, nam); + m_freem(nam); + } + FRELE(fp); return (error); } @@ -140,7 +142,10 @@ sys_listen(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); - return (solisten((struct socket *)fp->f_data, SCARG(uap, backlog))); + FREF(fp); + error = solisten((struct socket *)fp->f_data, SCARG(uap, backlog)); + FRELE(fp); + return (error); } int @@ -149,12 +154,12 @@ sys_accept(p, v, retval) void *v; register_t *retval; { - register struct sys_accept_args /* { + struct sys_accept_args /* { syscallarg(int) s; syscallarg(struct sockaddr *) name; syscallarg(socklen_t *) anamelen; } */ *uap = v; - struct file *fp; + struct file *fp, *headfp; struct mbuf *nam; socklen_t namelen; int error, s, tmpfd; @@ -166,15 +171,17 @@ sys_accept(p, v, retval) return (error); if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); + FREF(fp); + headfp = fp; s = splsoftnet(); head = (struct socket *)fp->f_data; if ((head->so_options & SO_ACCEPTCONN) == 0) { - splx(s); - return (EINVAL); + error = EINVAL; + goto bad; } if ((head->so_state & SS_NBIO) && head->so_qlen == 0) { - splx(s); - return (EWOULDBLOCK); + error = EWOULDBLOCK; + goto bad; } while (head->so_qlen == 0 && head->so_error == 0) { if (head->so_state & SS_CANTRCVMORE) { @@ -184,15 +191,13 @@ sys_accept(p, v, retval) error = tsleep((caddr_t)&head->so_timeo, PSOCK | PCATCH, netcon, 0); if (error) { - splx(s); - return (error); + goto bad; } } if (head->so_error) { error = head->so_error; head->so_error = 0; - splx(s); - return (error); + goto bad; } /* @@ -251,8 +256,10 @@ sys_accept(p, v, retval) closef(fp, p); } m_freem(nam); - splx(s); FILE_SET_MATURE(fp); +bad: + splx(s); + FRELE(headfp); return (error); } @@ -263,14 +270,14 @@ sys_connect(p, v, retval) void *v; register_t *retval; { - register struct sys_connect_args /* { + struct sys_connect_args /* { syscallarg(int) s; syscallarg(struct sockaddr *) name; syscallarg(socklen_t) namelen; } */ *uap = v; struct file *fp; - register struct socket *so; - struct mbuf *nam; + struct socket *so; + struct mbuf *nam = NULL; int error, s; if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) @@ -278,14 +285,16 @@ sys_connect(p, v, retval) so = (struct socket *)fp->f_data; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) return (EALREADY); + FREF(fp); error = sockargs(&nam, (caddr_t)SCARG(uap, name), SCARG(uap, namelen), MT_SONAME); if (error) - return (error); + goto bad; error = soconnect(so, nam); if (error) goto bad; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) { + FRELE(fp); m_freem(nam); return (EINPROGRESS); } @@ -303,7 +312,9 @@ sys_connect(p, v, retval) splx(s); bad: so->so_state &= ~SS_ISCONNECTING; - m_freem(nam); + FRELE(fp); + if (nam) + m_freem(nam); if (error == ERESTART) error = EINTR; return (error); @@ -453,16 +464,16 @@ done: int sendit(p, s, mp, flags, retsize) - register struct proc *p; + struct proc *p; int s; - register struct msghdr *mp; + struct msghdr *mp; int flags; register_t *retsize; { struct file *fp; struct uio auio; - register struct iovec *iov; - register int i; + struct iovec *iov; + int i; struct mbuf *to, *control; int len, error; #ifdef KTRACE @@ -485,11 +496,14 @@ sendit(p, s, mp, flags, retsize) (auio.uio_resid += iov->iov_len) > SSIZE_MAX) return (EINVAL); } + FREF(fp); if (mp->msg_name) { error = sockargs(&to, mp->msg_name, mp->msg_namelen, MT_SONAME); - if (error) + if (error) { + FRELE(fp); return (error); + } } else to = 0; if (mp->msg_control) { @@ -546,6 +560,7 @@ sendit(p, s, mp, flags, retsize) } #endif bad: + FRELE(fp); if (to) m_freem(to); return (error); @@ -639,9 +654,9 @@ done: int recvit(p, s, mp, namelenp, retsize) - register struct proc *p; + struct proc *p; int s; - register struct msghdr *mp; + struct msghdr *mp; caddr_t namelenp; register_t *retsize; { @@ -672,6 +687,7 @@ recvit(p, s, mp, namelenp, retsize) (auio.uio_resid += iov->iov_len) > SSIZE_MAX) return (EINVAL); } + FREF(fp); #ifdef KTRACE if (KTRPOINT(p, KTR_GENIO)) { int iovlen = auio.uio_iovcnt * sizeof (struct iovec); @@ -780,6 +796,7 @@ recvit(p, s, mp, namelenp, retsize) mp->msg_controllen = len; } out: + FRELE(fp); if (from) m_freem(from); if (control) @@ -794,7 +811,7 @@ sys_shutdown(p, v, retval) void *v; register_t *retval; { - register struct sys_shutdown_args /* { + struct sys_shutdown_args /* { syscallarg(int) s; syscallarg(int) how; } */ *uap = v; @@ -803,7 +820,10 @@ sys_shutdown(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); - return (soshutdown((struct socket *)fp->f_data, SCARG(uap, how))); + FREF(fp); + error = soshutdown((struct socket *)fp->f_data, SCARG(uap, how)); + FRELE(fp); + return (error); } /* ARGSUSED */ @@ -813,7 +833,7 @@ sys_setsockopt(p, v, retval) void *v; register_t *retval; { - register struct sys_setsockopt_args /* { + struct sys_setsockopt_args /* { syscallarg(int) s; syscallarg(int) level; syscallarg(int) name; @@ -828,27 +848,35 @@ sys_setsockopt(p, v, retval) return (error); if (SCARG(uap, valsize) > MCLBYTES) return (EINVAL); + FREF(fp); if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if (SCARG(uap, valsize) > MLEN) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return (ENOBUFS); + error = ENOBUFS; + goto bad; } } - if (m == NULL) - return (ENOBUFS); + if (m == NULL) { + error = ENOBUFS; + goto bad; + } error = copyin(SCARG(uap, val), mtod(m, caddr_t), SCARG(uap, valsize)); if (error) { - (void) m_free(m); - return (error); + goto bad; } m->m_len = SCARG(uap, valsize); } - return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), - SCARG(uap, name), m)); + error = sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), m); + m = NULL; +bad: + if (m) + m_freem(m); + FRELE(fp); + return (error); } /* ARGSUSED */ @@ -858,7 +886,7 @@ sys_getsockopt(p, v, retval) void *v; register_t *retval; { - register struct sys_getsockopt_args /* { + struct sys_getsockopt_args /* { syscallarg(int) s; syscallarg(int) level; syscallarg(int) name; @@ -872,11 +900,12 @@ sys_getsockopt(p, v, retval) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) return (error); + FREF(fp); if (SCARG(uap, val)) { error = copyin((caddr_t)SCARG(uap, avalsize), (caddr_t)&valsize, sizeof (valsize)); if (error) - return (error); + goto out; } else valsize = 0; if ((error = sogetopt((struct socket *)fp->f_data, SCARG(uap, level), @@ -889,6 +918,8 @@ sys_getsockopt(p, v, retval) error = copyout((caddr_t)&valsize, (caddr_t)SCARG(uap, avalsize), sizeof (valsize)); } +out: + FRELE(fp); if (m != NULL) (void) m_free(m); return (error); @@ -927,22 +958,23 @@ sys_getsockname(p, v, retval) void *v; register_t *retval; { - register struct sys_getsockname_args /* { + struct sys_getsockname_args /* { syscallarg(int) fdes; syscallarg(caddr_t) asa; syscallarg(socklen_t *) alen; } */ *uap = v; struct file *fp; - register struct socket *so; - struct mbuf *m; + struct socket *so; + struct mbuf *m = NULL; socklen_t len; int error; if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0) return (error); + FREF(fp); error = copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, sizeof (len)); if (error) - return (error); + goto bad; so = (struct socket *)fp->f_data; m = m_getclr(M_WAIT, MT_SONAME); error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0); @@ -955,7 +987,9 @@ sys_getsockname(p, v, retval) error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), sizeof (len)); bad: - m_freem(m); + FRELE(fp); + if (m) + m_freem(m); return (error); } @@ -969,14 +1003,14 @@ sys_getpeername(p, v, retval) void *v; register_t *retval; { - register struct sys_getpeername_args /* { + struct sys_getpeername_args /* { syscallarg(int) fdes; syscallarg(caddr_t) asa; syscallarg(socklen_t *) alen; } */ *uap = v; struct file *fp; register struct socket *so; - struct mbuf *m; + struct mbuf *m = NULL; socklen_t len; int error; @@ -985,9 +1019,10 @@ sys_getpeername(p, v, retval) so = (struct socket *)fp->f_data; if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) return (ENOTCONN); + FREF(fp); error = copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, sizeof (len)); if (error) - return (error); + goto bad; m = m_getclr(M_WAIT, MT_SONAME); error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, 0, m, 0); if (error) @@ -999,6 +1034,7 @@ sys_getpeername(p, v, retval) error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), sizeof (len)); bad: + FRELE(fp); m_freem(m); return (error); } @@ -1013,14 +1049,14 @@ sys_getpeereid(p, v, retval) void *v; register_t *retval; { - register struct sys_getpeereid_args /* { + struct sys_getpeereid_args /* { syscallarg(int) fdes; syscallarg(uid_t *) euid; syscallarg(gid_t *) egid; } */ *uap = v; struct file *fp; - register struct socket *so; - struct mbuf *m; + struct socket *so; + struct mbuf *m = NULL; struct unpcbid *id; int error; @@ -1029,9 +1065,12 @@ sys_getpeereid(p, v, retval) so = (struct socket *)fp->f_data; if (so->so_proto != pffindtype(AF_LOCAL, SOCK_STREAM)) return (EOPNOTSUPP); + FREF(fp); m = m_getclr(M_WAIT, MT_SONAME); - if (m == NULL) - return (ENOBUFS); + if (m == NULL) { + error = ENOBUFS; + goto bad; + } error = (*so->so_proto->pr_usrreq)(so, PRU_PEEREID, 0, m, 0); if (!error && m->m_len != sizeof(struct unpcbid)) error = EOPNOTSUPP; @@ -1044,6 +1083,7 @@ sys_getpeereid(p, v, retval) error = copyout((caddr_t)&(id->unp_egid), (caddr_t)SCARG(uap, egid), sizeof(gid_t)); bad: + FRELE(fp); m_freem(m); return (error); } @@ -1055,8 +1095,8 @@ sockargs(mp, buf, buflen, type) socklen_t buflen; int type; { - register struct sockaddr *sa; - register struct mbuf *m; + struct sockaddr *sa; + struct mbuf *m; int error; /* @@ -1097,12 +1137,9 @@ sockargs(mp, buf, buflen, type) } int -getsock(fdp, fdes, fpp) - struct filedesc *fdp; - int fdes; - struct file **fpp; +getsock(struct filedesc *fdp, int fdes, struct file **fpp) { - register struct file *fp; + struct file *fp; if ((fp = fd_getfile(fdp, fdes)) == NULL) return (EBADF); diff --git a/sys/miscfs/portal/portal_vfsops.c b/sys/miscfs/portal/portal_vfsops.c index 86187f81f98..b65841ed79b 100644 --- a/sys/miscfs/portal/portal_vfsops.c +++ b/sys/miscfs/portal/portal_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: portal_vfsops.c,v 1.11 2002/02/08 13:53:28 art Exp $ */ +/* $OpenBSD: portal_vfsops.c,v 1.12 2002/02/12 13:05:32 art Exp $ */ /* $NetBSD: portal_vfsops.c,v 1.14 1996/02/09 22:40:41 christos Exp $ */ /* @@ -108,9 +108,13 @@ portal_mount(mp, path, data, ndp, p) if (so->so_proto->pr_domain->dom_family != AF_UNIX) return (ESOCKTNOSUPPORT); + FREF(fp); + error = getnewvnode(VT_PORTAL, mp, portal_vnodeop_p, &rvp); /* XXX */ - if (error) + if (error) { + FRELE(fp); return (error); + } MALLOC(rvp->v_data, void *, sizeof(struct portalnode), M_TEMP, M_WAITOK); @@ -122,7 +126,9 @@ portal_mount(mp, path, data, ndp, p) VTOPORTAL(rvp)->pt_size = 0; VTOPORTAL(rvp)->pt_fileid = PORTAL_ROOTFILEID; fmp->pm_root = rvp; - fmp->pm_server = fp; fp->f_count++; + fmp->pm_server = fp; + fp->f_count++; + FRELE(fp); mp->mnt_flag |= MNT_LOCAL; mp->mnt_data = (qaddr_t)fmp; diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 1ea7a994fe1..910b9c3e29d 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.28 2002/02/10 22:02:05 nate Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.29 2002/02/12 13:05:32 art Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -287,6 +287,7 @@ sys_nfssvc(p, v, retval) error = getsock(p->p_fd, nfsdarg.sock, &fp); if (error) return (error); + FREF(fp); /* * Get the client address for connected sockets. */ @@ -295,10 +296,13 @@ sys_nfssvc(p, v, retval) else { error = sockargs(&nam, nfsdarg.name, nfsdarg.namelen, MT_SONAME); - if (error) + if (error) { + FRELE(fp); return (error); + } } error = nfssvc_addsock(fp, nam); + FRELE(fp); #endif /* !NFSSERVER */ } else { #ifndef NFSSERVER |