Date: Sun, 19 Apr 2009 22:01:38 +0000 (UTC) From: Robert Watson <rwatson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r191281 - head/sys/netatalk Message-ID: <200904192201.n3JM1cPU021514@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904192201.n3JM1cPU021514>