summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-07-05 13:10:10 +0000
committerrwatson <rwatson@FreeBSD.org>2008-07-05 13:10:10 +0000
commit051819b84758e212ecd632e9bd6f47e70f37aa3a (patch)
treefcde383ade7af0060da3dd095039791d9e423bee /sys/netinet6/in6.c
parentb754e07b66100e4e4d6ac8caa8f6302730552936 (diff)
downloadFreeBSD-src-051819b84758e212ecd632e9bd6f47e70f37aa3a.zip
FreeBSD-src-051819b84758e212ecd632e9bd6f47e70f37aa3a.tar.gz
Introduce a new lock, hostname_mtx, and use it to synchronize access
to global hostname and domainname variables. Where necessary, copy to or from a stack-local buffer before performing copyin() or copyout(). A few uses, such as in cd9660 and daemon_saver, remain under-synchronized and will require further updates. Correct a bug in which a failed copyin() of domainname would leave domainname potentially corrupted. MFC after: 3 weeks
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r--sys/netinet6/in6.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index c24ca20..bc9dcc9 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1159,8 +1159,10 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
delay = arc4random() %
(MAX_RTR_SOLICITATION_DELAY * hz);
}
+ mtx_lock(&hostname_mtx);
if (in6_nigroup(ifp, hostname, hostnamelen, &mltaddr.sin6_addr)
== 0) {
+ mtx_unlock(&hostname_mtx);
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error,
delay); /* XXX jinmei */
if (!imm) {
@@ -1174,7 +1176,8 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
LIST_INSERT_HEAD(&ia->ia6_memberships,
imm, i6mm_chain);
}
- }
+ } else
+ mtx_unlock(&hostname_mtx);
#undef hostnamelen
/*
OpenPOWER on IntegriCloud