From 135a94b34b4288a6f5ff890b035519c060fa1a1c Mon Sep 17 00:00:00 2001 From: sam Date: Thu, 13 Nov 2003 05:16:56 +0000 Subject: o reorder some locking asserts to reflect the order of the locks o correct a read-lock assert in in_pcblookup_local that should be a write-lock assert (since time wait close cleanups may alter state) Supported by: FreeBSD Foundation --- sys/netinet/in_pcb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/netinet/in_pcb.c') diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index eda8053..48fed21 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -208,9 +208,9 @@ in_pcbbind(inp, nam, td) { int anonport, error; + INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_LOCK_ASSERT(inp); - INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY) return (EINVAL); anonport = inp->inp_lport == 0 && (nam == NULL || @@ -255,9 +255,9 @@ in_pcbbind_setup(inp, nam, laddrp, lportp, td) int wild = 0, reuseport = (so->so_options & SO_REUSEPORT); int error, prison = 0; + INP_INFO_WLOCK_ASSERT(pcbinfo); INP_LOCK_ASSERT(inp); - INP_INFO_WLOCK_ASSERT(pcbinfo); if (TAILQ_EMPTY(&in_ifaddrhead)) /* XXX broken! */ return (EADDRNOTAVAIL); laddr.s_addr = *laddrp; @@ -939,7 +939,8 @@ in_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay) int matchwild = 3, wildcard; u_short lport = lport_arg; - INP_INFO_RLOCK_ASSERT(pcbinfo); + INP_INFO_WLOCK_ASSERT(pcbinfo); + if (!wild_okay) { struct inpcbhead *head; /* -- cgit v1.1