diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index f65b09f17a5..a76a185474d 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1696,11 +1696,7 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) default: return (error); } - INP_WLOCK(inp); - if (inp->inp_flags & INP_DROPPED) { - INP_WUNLOCK(inp); - return (ECONNRESET); - } + INP_WLOCK_RECHECK(inp); } else if (sopt->sopt_name == TCP_FUNCTION_BLK) { /* * Protect the TCP option TCP_FUNCTION_BLK so @@ -1715,8 +1711,7 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt) if (error) return (error); - INP_WLOCK(inp); - tp = intotcpcb(inp); + INP_WLOCK_RECHECK(inp); blk = find_and_ref_tcp_functions(&fsn); if (blk == NULL) {