Date: Sun, 11 Apr 2010 18:47:39 +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: r206488 - head/sys/net Message-ID: <201004111847.o3BIldr9080554@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sun Apr 11 18:47:38 2010 New Revision: 206488 URL: http://svn.freebsd.org/changeset/base/206488 Log: 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) MFC after: 10 days Modified: head/sys/net/if_clone.c Modified: head/sys/net/if_clone.c ============================================================================== --- head/sys/net/if_clone.c Sun Apr 11 18:44:42 2010 (r206487) +++ head/sys/net/if_clone.c Sun Apr 11 18:47:38 2010 (r206488) @@ -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?201004111847.o3BIldr9080554>