Date: Wed, 21 Apr 2010 19:55:43 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r207014 - stable/8/sys/net Message-ID: <201004211955.o3LJthEg052437@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Wed Apr 21 19:55:43 2010 New Revision: 207014 URL: http://svn.freebsd.org/changeset/base/207014 Log: MFC r206486: Check that the interface is on the list of cloned interfaces before trying to remove it to avoid panics in case of two threads trying to remove it in parallel. PR: kern/116837 Submitted by: Takahiro Kurosawa (takahiro.kurosawa gmail.com) (orig version) Modified: stable/8/sys/net/if_clone.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/net/if_clone.c ============================================================================== --- stable/8/sys/net/if_clone.c Wed Apr 21 19:51:22 2010 (r207013) +++ stable/8/sys/net/if_clone.c Wed Apr 21 19:55:43 2010 (r207014) @@ -234,6 +234,7 @@ int if_clone_destroyif(struct if_clone *ifc, struct ifnet *ifp) { int err; + struct ifnet *ifcifp; if (ifc->ifc_destroy == NULL) return(EOPNOTSUPP); @@ -246,8 +247,17 @@ if_clone_destroyif(struct if_clone *ifc, CURVNET_SET_QUIET(ifp->if_vnet); IF_CLONE_LOCK(ifc); - IFC_IFLIST_REMOVE(ifc, ifp); + LIST_FOREACH(ifcifp, &ifc->ifc_iflist, if_clones) { + if (ifcifp == ifp) { + IFC_IFLIST_REMOVE(ifc, ifp); + break; + } + } IF_CLONE_UNLOCK(ifc); + if (ifcifp == NULL) { + CURVNET_RESTORE(); + return (ENXIO); /* ifp is not on the list. */ + } if_delgroup(ifp, ifc->ifc_name);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004211955.o3LJthEg052437>