diff options
author | Bryan Cantrill <bryan@joyent.com> | 2016-09-24 08:43:10 -0700 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2016-10-11 11:14:30 -0700 |
commit | 854956ce2a18fd37e3f6160d38ffb87fdbc2edc4 (patch) | |
tree | 7854044a320a40c4603857830089ded254695860 /usr/src/uts/common/os/netstack.c | |
parent | 860884eb865676dc41b8ef65c09df94f7c3f14ef (diff) | |
download | illumos-gate-854956ce2a18fd37e3f6160d38ffb87fdbc2edc4.tar.gz |
7413 netstack leaks lead to blind netstack reuse
7414 iptun leaks netstacks
7415 ipnet_promisc_add() leaks netstacks in error paths
7416 ill_lookup_on_ifindex_global_instance() could leak netstack ids
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/uts/common/os/netstack.c')
-rw-r--r-- | usr/src/uts/common/os/netstack.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/usr/src/uts/common/os/netstack.c b/usr/src/uts/common/os/netstack.c index 5c556bffef..1bed9d7406 100644 --- a/usr/src/uts/common/os/netstack.c +++ b/usr/src/uts/common/os/netstack.c @@ -22,7 +22,7 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2016, Joyent, Inc. All rights reserved. */ #include <sys/param.h> @@ -340,7 +340,7 @@ netstack_zone_create(zoneid_t zoneid) /* * Should never find a pre-existing exclusive stack */ - ASSERT(stackid == GLOBAL_NETSTACKID); + VERIFY(stackid == GLOBAL_NETSTACKID); kmem_free(ns, sizeof (netstack_t)); ns = *nsp; mutex_enter(&ns->netstack_lock); @@ -1041,6 +1041,26 @@ netstack_find_by_stackid(netstackid_t stackid) return (NULL); } +boolean_t +netstack_inuse_by_stackid(netstackid_t stackid) +{ + netstack_t *ns; + boolean_t rval = B_FALSE; + + mutex_enter(&netstack_g_lock); + + for (ns = netstack_head; ns != NULL; ns = ns->netstack_next) { + if (ns->netstack_stackid == stackid) { + rval = B_TRUE; + break; + } + } + + mutex_exit(&netstack_g_lock); + + return (rval); +} + void netstack_rele(netstack_t *ns) { |