summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2011-12-28 21:17:28 +0000
committerBryan Cantrill <bryan@joyent.com>2011-12-28 21:17:28 +0000
commit81aba0c52267982673db217070e4c32b7f6202c7 (patch)
treee243a085056ff12f21d6e6290dbcb8a098f959be /usr
parent2b157db48231a300113c7c13a26b28bd4bd0f283 (diff)
downloadillumos-joyent-81aba0c52267982673db217070e4c32b7f6202c7.tar.gz
OS-830 stack overflow from mac_promisc_dispatch()
Diffstat (limited to 'usr')
-rw-r--r--usr/src/uts/common/io/dls/dls.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr/src/uts/common/io/dls/dls.c b/usr/src/uts/common/io/dls/dls.c
index e29b1ee6ac..e2367f9e4a 100644
--- a/usr/src/uts/common/io/dls/dls.c
+++ b/usr/src/uts/common/io/dls/dls.c
@@ -24,6 +24,10 @@
*/
/*
+ * Copyright 2011 Joyent, Inc. All rights reserved.
+ */
+
+/*
* Data-Link Services Module
*/
@@ -596,6 +600,22 @@ boolean_t
dls_accept_promisc(dld_str_t *dsp, mac_header_info_t *mhip, dls_rx_t *ds_rx,
void **ds_rx_arg, boolean_t loopback)
{
+ if (dsp->ds_promisc == 0) {
+ /*
+ * If there are active walkers of the mi_promisc_list when
+ * promiscuousness is disabled, ds_promisc will be cleared,
+ * but the DLS will remain on the mi_promisc_list until the
+ * walk is completed. If we do not recognize this case here,
+ * we won't properly execute the ds_promisc case in the common
+ * accept routine -- and we will potentially accept a packet
+ * that has originated with this DLS (which in turn can
+ * induce recursion and death by stack overflow). If
+ * ds_promisc is zero, we know that we are in this window --
+ * and we refuse to accept the packet.
+ */
+ return (B_FALSE);
+ }
+
return (dls_accept_common(dsp, mhip, ds_rx, ds_rx_arg, B_TRUE,
loopback));
}