Date: Wed, 10 Sep 2008 17:49:49 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 149551 for review Message-ID: <200809101749.m8AHnnV1095253@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149551 Change 149551 by zec@zec_tpx32 on 2008/09/10 17:48:54 Hold IFNET_WLOCK() when reassigning an ifnet from one vnet to another. Affected files ... .. //depot/projects/vimage/src/sys/kern/kern_vimage.c#67 edit Differences ... ==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#67 (text+ko) ==== @@ -298,10 +298,11 @@ do { INIT_VNET_NET(curvnet); + IFNET_WLOCK(); ifnet_setbyindex(ifp->if_index, NULL); - /* XXX: should be locked with if_findindex() */ while (V_if_index > 0 && ifnet_byindex(V_if_index) == NULL) V_if_index--; + IFNET_WUNLOCK(); } while (0); CURVNET_SET_QUIET(new_vnet); @@ -309,9 +310,8 @@ /* * Try to find an empty slot below if_index. If we fail, take * the next slot. - * - * XXX: should be locked! */ + IFNET_WLOCK(); for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) { if (ifnet_byindex(ifp->if_index) == NULL) break; @@ -325,6 +325,7 @@ if (V_if_index >= V_if_indexlim) if_grow(); ifnet_setbyindex(ifp->if_index, ifp); + IFNET_WUNLOCK(); /* Rename the ifnet */ if (new_vnet == ifp->if_home_vnet) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809101749.m8AHnnV1095253>