Author: rwatson Date: Sun Apr 19 22:01:38 2009 New Revision: 191281 URL: http://svn.freebsd.org/changeset/base/191281
Log: Lock interface address list lock around ifaddr inserts and deletes in at_control(). This locking is not yet complete but should prevent some classes of race conditions. MFC after: 2 weeks Modified: head/sys/netatalk/at_control.c Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Sun Apr 19 21:37:45 2009 (r191280) +++ head/sys/netatalk/at_control.c Sun Apr 19 22:01:38 2009 (r191281) @@ -191,7 +191,6 @@ at_control(struct socket *so, u_long cmd ifa = (struct ifaddr *)aa; IFA_LOCK_INIT(ifa); ifa->ifa_refcnt = 1; - TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); /* * As the at_ifaddr contains the actual sockaddrs, @@ -214,6 +213,9 @@ at_control(struct socket *so, u_long cmd * and link it all together */ aa->aa_ifp = ifp; + IF_ADDR_LOCK(ifp); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); } else { /* * If we DID find one then we clobber any routes @@ -296,7 +298,9 @@ at_control(struct socket *so, u_long cmd * remove the ifaddr from the interface */ ifa0 = (struct ifaddr *)aa; + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa0, ifa_link); + IF_ADDR_UNLOCK(ifp); /* * Now remove the at_ifaddr from the parallel structure _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"