diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-04-15 05:24:23 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-04-15 05:24:23 +0000 |
commit | 6e218df686c61480d1fa8d3ad7cf43360002f900 (patch) | |
tree | 0f6f2015617a1f70d162cafb27ebd4a349fe2c15 /sys/netinet6 | |
parent | 6a0a3efe6f9ec1e4434b095454e3ea5eb7e11565 (diff) | |
download | FreeBSD-src-6e218df686c61480d1fa8d3ad7cf43360002f900.zip FreeBSD-src-6e218df686c61480d1fa8d3ad7cf43360002f900.tar.gz |
Mirror IPv4 pcb locking into in6_setsockaddr() and in6_setpeeraddr():
acquire inpcb lock when reading inpcb port+address in order to prevent
races with other threads that may be changing them.
MFC after: 3 months
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_pcb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index d860363..d331da3 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -520,8 +520,10 @@ in6_setsockaddr(so, nam) inp = sotoinpcb(so); KASSERT(inp != NULL, ("in6_setsockaddr: inp == NULL")); + INP_LOCK(inp); port = inp->inp_lport; addr = inp->in6p_laddr; + INP_UNLOCK(inp); *nam = in6_sockaddr(port, &addr); return 0; @@ -539,8 +541,10 @@ in6_setpeeraddr(so, nam) inp = sotoinpcb(so); KASSERT(inp != NULL, ("in6_setpeeraddr: inp == NULL")); + INP_LOCK(inp); port = inp->inp_fport; addr = inp->in6p_faddr; + INP_UNLOCK(inp); *nam = in6_sockaddr(port, &addr); return 0; |