diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 3b7f8d0a1df..ba41780ed98 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -2671,24 +2671,23 @@ nfsrv_getsocksndseq(struct socket *so, tcp_seq *maxp, tcp_seq *unap) { struct inpcb *inp; struct tcpcb *tp; - int error = EPIPE; - INP_INFO_RLOCK(&V_tcbinfo); inp = sotoinpcb(so); - if (inp == NULL) { - INP_INFO_RUNLOCK(&V_tcbinfo); - return (error); - } + KASSERT(inp != NULL, ("nfsrv_getsocksndseq: inp == NULL")); INP_RLOCK(inp); - INP_INFO_RUNLOCK(&V_tcbinfo); - tp = intotcpcb(inp); - if (tp != NULL && tp->t_state == TCPS_ESTABLISHED) { - *maxp = tp->snd_max; - *unap = tp->snd_una; - error = 0; + if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + INP_RUNLOCK(inp); + return (EPIPE); } + tp = intotcpcb(inp); + if (tp->t_state != TCPS_ESTABLISHED) { + INP_RUNLOCK(inp); + return (EPIPE); + } + *maxp = tp->snd_max; + *unap = tp->snd_una; INP_RUNLOCK(inp); - return (error); + return (0); } /*