From owner-svn-src-head@FreeBSD.ORG Sun Apr 19 22:01:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A00F106564A; Sun, 19 Apr 2009 22:01:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 590F98FC1C; Sun, 19 Apr 2009 22:01:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3JM1chU021515; Sun, 19 Apr 2009 22:01:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3JM1cPU021514; Sun, 19 Apr 2009 22:01:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200904192201.n3JM1cPU021514@svn.freebsd.org> From: Robert Watson Date: Sun, 19 Apr 2009 22:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191281 - head/sys/netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Apr 2009 22:01:38 -0000 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