Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Sep 2009 21:30:18 +0000 (UTC)
From:      Marko Zec <zec@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r197176 - head/sys/compat/linux
Message-ID:  <200909132130.n8DLUIjG032215@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zec
Date: Sun Sep 13 21:30:18 2009
New Revision: 197176
URL: http://svn.freebsd.org/changeset/base/197176

Log:
  Lock the ifnet list while iterating over it.
  
  Submitted by:	julian
  MFC after:	3 days

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Sun Sep 13 20:19:02 2009	(r197175)
+++ head/sys/compat/linux/linux_ioctl.c	Sun Sep 13 21:30:18 2009	(r197176)
@@ -2152,6 +2152,7 @@ linux_ifconf(struct thread *td, struct i
 	/* handle the 'request buffer size' case */
 	if (ifc.ifc_buf == PTROUT(NULL)) {
 		ifc.ifc_len = 0;
+		IFNET_RLOCK();
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 				struct sockaddr *sa = ifa->ifa_addr;
@@ -2159,6 +2160,7 @@ linux_ifconf(struct thread *td, struct i
 					ifc.ifc_len += sizeof(ifr);
 			}
 		}
+		IFNET_RUNLOCK();
 		error = copyout(&ifc, uifc, sizeof(ifc));
 		CURVNET_RESTORE();
 		return (error);



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