diff options
author | Bryan Cantrill <bryan@joyent.com> | 2016-09-06 22:13:54 +0000 |
---|---|---|
committer | Bryan Cantrill <bryan@joyent.com> | 2016-09-09 20:55:11 +0000 |
commit | 30929368aafd4ac5de5f09aa113e55772d766549 (patch) | |
tree | d5b62dc02fc844e0fb80f74f00f5943750ab8119 /usr/src/uts/common/os/netstack.c | |
parent | d09721f7446ca0fcc46a38cae275f18d560585c7 (diff) | |
download | illumos-joyent-30929368aafd4ac5de5f09aa113e55772d766549.tar.gz |
OS-4810 Panic: BAD TRAP in udp_do_open
OS-5631 iptun leaks netstacks
OS-5632 ipnet_promisc_add() leaks netstacks in error paths
OS-5633 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>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.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) { |