Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jun 2016 16:23:02 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301514 - head/sys/net
Message-ID:  <201606061623.u56GN2SQ012346@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Mon Jun  6 16:23:02 2016
New Revision: 301514
URL: https://svnweb.freebsd.org/changeset/base/301514

Log:
  Similarly to r301505 protect the removal of the ifa from the if_addrhead
  by a lock (as well as the check that the list is not empty).
  
  Obtained from:	projects/vnet
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Mon Jun  6 16:10:52 2016	(r301513)
+++ head/sys/net/if.c	Mon Jun  6 16:23:02 2016	(r301514)
@@ -1007,11 +1007,14 @@ if_detach_internal(struct ifnet *ifp, in
 		ifp->if_addr = NULL;
 
 		/* We can now free link ifaddr. */
+		IF_ADDR_WLOCK(ifp);
 		if (!TAILQ_EMPTY(&ifp->if_addrhead)) {
 			ifa = TAILQ_FIRST(&ifp->if_addrhead);
 			TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
+			IF_ADDR_WUNLOCK(ifp);
 			ifa_free(ifa);
-		}
+		} else
+			IF_ADDR_WUNLOCK(ifp);
 	}
 
 	rt_flushifroutes(ifp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606061623.u56GN2SQ012346>