diff options
author | ups <ups@FreeBSD.org> | 2006-07-18 22:34:27 +0000 |
---|---|---|
committer | ups <ups@FreeBSD.org> | 2006-07-18 22:34:27 +0000 |
commit | ee0a5eb928ae5ccdf1a0e619b4ba6e93d19db5fb (patch) | |
tree | 2e39fd9d815a6efa63bdabd6bfed00c38e05310a /sys/netinet/tcp_usrreq.c | |
parent | 9adb8df4815a901cfc690d567d4ba0b6c63b1d5d (diff) | |
download | FreeBSD-src-ee0a5eb928ae5ccdf1a0e619b4ba6e93d19db5fb.zip FreeBSD-src-ee0a5eb928ae5ccdf1a0e619b4ba6e93d19db5fb.tar.gz |
Fix race conditions on enumerating pcb lists by moving the initialization
( and where appropriate the destruction) of the pcb mutex to the init/finit
functions of the pcb zones.
This allows locking of the pcb entries and race condition free comparison
of the generation count.
Rearrange locking a bit to avoid extra locking operation to update the generation
count in in_pcballoc(). (in_pcballoc now returns the pcb locked)
I am planning to convert pcb list handling from a type safe to a reference count
model soon. ( As this allows really freeing the PCBs)
Reviewed by: rwatson@, mohans@
MFC after: 1 week
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index e6a31fa..111a983 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1401,13 +1401,12 @@ tcp_attach(so) return (error); } INP_INFO_WLOCK(&tcbinfo); - error = in_pcballoc(so, &tcbinfo, "tcpinp"); + error = in_pcballoc(so, &tcbinfo); if (error) { INP_INFO_WUNLOCK(&tcbinfo); return (error); } inp = sotoinpcb(so); - INP_LOCK(inp); #ifdef INET6 if (isipv6) { inp->inp_vflag |= INP_IPV6; |