Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2010 20:00:13 +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: r207015 - stable/8/sys/net
Message-ID:  <201004212000.o3LK0Df1053520@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Wed Apr 21 20:00:13 2010
New Revision: 207015
URL: http://svn.freebsd.org/changeset/base/207015

Log:
  MFC r206488:
  
    Take a reference to make sure that the interface cannot go away during
    if_clone_destroy() in case parallel threads try to.
  
  PR:		kern/116837
  Submitted by:	Mikolaj Golub (to.my.trociny gmail.com)

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:55:43 2010	(r207014)
+++ stable/8/sys/net/if_clone.c	Wed Apr 21 20:00:13 2010	(r207015)
@@ -196,10 +196,11 @@ if_clone_createif(struct if_clone *ifc, 
 int
 if_clone_destroy(const char *name)
 {
+	int err;
 	struct if_clone *ifc;
 	struct ifnet *ifp;
 
-	ifp = ifunit(name);
+	ifp = ifunit_ref(name);
 	if (ifp == NULL)
 		return (ENXIO);
 
@@ -221,10 +222,14 @@ if_clone_destroy(const char *name)
 	}
 #endif
 	IF_CLONERS_UNLOCK();
-	if (ifc == NULL)
+	if (ifc == NULL) {
+		if_rele(ifp);
 		return (EINVAL);
+	}
 
-	return (if_clone_destroyif(ifc, ifp));
+	err = if_clone_destroyif(ifc, ifp);
+	if_rele(ifp);
+	return err;
 }
 
 /*



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