summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-08-09 00:15:17 +0000
committerbapt <bapt@FreeBSD.org>2015-08-09 00:15:17 +0000
commit2c81d1658920f732f451e9edffa48cf9b90607b1 (patch)
tree20549ce39ea8b5a45adaa22dbf88f3cba90d926d /sys/netinet/tcp_usrreq.c
parentee75e8628c34502fa04b16cab8adb0a4ab24a2fc (diff)
parent9e0d1c3e199cfcd8480d2e892da387ebb1bbde8b (diff)
downloadFreeBSD-src-2c81d1658920f732f451e9edffa48cf9b90607b1.zip
FreeBSD-src-2c81d1658920f732f451e9edffa48cf9b90607b1.tar.gz
Merge from HEAD
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 36d5312..fe390e0 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -163,7 +163,7 @@ tcp_detach(struct socket *so, struct inpcb *inp)
{
struct tcpcb *tp;
- INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+ INP_INFO_LOCK_ASSERT(&V_tcbinfo);
INP_WLOCK_ASSERT(inp);
KASSERT(so->so_pcb == inp, ("tcp_detach: so_pcb != inp"));
@@ -241,15 +241,20 @@ static void
tcp_usr_detach(struct socket *so)
{
struct inpcb *inp;
+ int rlock = 0;
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_detach: inp == NULL"));
- INP_INFO_RLOCK(&V_tcbinfo);
+ if (!INP_INFO_WLOCKED(&V_tcbinfo)) {
+ INP_INFO_RLOCK(&V_tcbinfo);
+ rlock = 1;
+ }
INP_WLOCK(inp);
KASSERT(inp->inp_socket != NULL,
("tcp_usr_detach: inp_socket == NULL"));
tcp_detach(so, inp);
- INP_INFO_RUNLOCK(&V_tcbinfo);
+ if (rlock)
+ INP_INFO_RUNLOCK(&V_tcbinfo);
}
#ifdef INET
OpenPOWER on IntegriCloud