summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2010-04-11 18:47:38 +0000
committerbz <bz@FreeBSD.org>2010-04-11 18:47:38 +0000
commit778f026aa2199cd4470f3732bc6e3319ef713c7d (patch)
treec28b37e81d00cbf2aef04cb523774b676067bf09 /sys/net
parentf0d40dc1bec03e04ae26310c6ba6e6b6964c3701 (diff)
downloadFreeBSD-src-778f026aa2199cd4470f3732bc6e3319ef713c7d.zip
FreeBSD-src-778f026aa2199cd4470f3732bc6e3319ef713c7d.tar.gz
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
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_clone.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index 81ac7ff..c02737b 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -196,10 +196,11 @@ if_clone_createif(struct if_clone *ifc, char *name, size_t len, caddr_t params)
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;
}
/*
OpenPOWER on IntegriCloud