summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/xen
diff options
context:
space:
mode:
authorDavid Edmondson <dme@sun.com>2009-11-11 08:26:00 -0800
committerDavid Edmondson <dme@sun.com>2009-11-11 08:26:00 -0800
commit0324f02a004039d6377111191fdd7134452d7817 (patch)
tree914f7acb62a21c69ee2fea23fb227c57c407757f /usr/src/uts/common/xen
parentb323a6159ab002be737b0f5f6a56ade96637e5bd (diff)
downloadillumos-gate-0324f02a004039d6377111191fdd7134452d7817.tar.gz
6899767 recursive mutex_enter in xnbo:xenbo_close_mac()
Diffstat (limited to 'usr/src/uts/common/xen')
-rw-r--r--usr/src/uts/common/xen/io/xnbo.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/usr/src/uts/common/xen/io/xnbo.c b/usr/src/uts/common/xen/io/xnbo.c
index 1f426016c1..f753b0d9c1 100644
--- a/usr/src/uts/common/xen/io/xnbo.c
+++ b/usr/src/uts/common/xen/io/xnbo.c
@@ -72,6 +72,7 @@ typedef struct xnbo {
} xnbo_t;
static void xnbo_close_mac(xnb_t *);
+static void i_xnbo_close_mac(xnb_t *, boolean_t);
/*
* Packets from the peer come here. We pass them to the mac device.
@@ -264,14 +265,14 @@ xnbo_open_mac(xnb_t *xnbp, char *mac)
if (mi->mi_media != DL_ETHER) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"device is not DL_ETHER (%d)", mi->mi_media);
- xnbo_close_mac(xnbp);
+ i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
if (mi->mi_media != mi->mi_nativemedia) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"device media and native media mismatch (%d != %d)",
mi->mi_media, mi->mi_nativemedia);
- xnbo_close_mac(xnbp);
+ i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
@@ -279,7 +280,7 @@ xnbo_open_mac(xnb_t *xnbp, char *mac)
if (max_sdu > XNBMAXPKT) {
cmn_err(CE_WARN, "xnbo_open_mac: mac device SDU too big (%d)",
max_sdu);
- xnbo_close_mac(xnbp);
+ i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
@@ -297,7 +298,7 @@ xnbo_open_mac(xnb_t *xnbp, char *mac)
MAC_OPEN_FLAGS_MULTI_PRIMARY) != 0) {
cmn_err(CE_WARN, "xnbo_open_mac: "
"error (%d) opening mac client", err);
- xnbo_close_mac(xnbp);
+ i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
@@ -312,7 +313,7 @@ xnbo_open_mac(xnb_t *xnbp, char *mac)
if (err != 0) {
cmn_err(CE_WARN, "xnbo_open_mac: failed to get the primary "
"MAC address of %s: %d", mac, err);
- xnbo_close_mac(xnbp);
+ i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
if (!xnbop->o_multicast_control) {
@@ -323,7 +324,7 @@ xnbo_open_mac(xnb_t *xnbp, char *mac)
cmn_err(CE_WARN, "xnbo_open_mac: "
"cannot enable promiscuous mode of %s: %d",
mac, err);
- xnbo_close_mac(xnbp);
+ i_xnbo_close_mac(xnbp, B_TRUE);
return (B_FALSE);
}
xnbop->o_promiscuous = B_TRUE;
@@ -353,19 +354,29 @@ xnbo_open_mac(xnb_t *xnbp, char *mac)
static void
xnbo_close_mac(xnb_t *xnbp)
{
+ i_xnbo_close_mac(xnbp, B_FALSE);
+}
+
+static void
+i_xnbo_close_mac(xnb_t *xnbp, boolean_t locked)
+{
xnbo_t *xnbop = xnbp->xnb_flavour_data;
xmca_t *loop;
+ ASSERT(!locked || MUTEX_HELD(&xnbp->xnb_state_lock));
+
if (xnbop->o_mh == NULL)
return;
if (xnbop->o_running)
xnbop->o_running = B_FALSE;
- mutex_enter(&xnbp->xnb_state_lock);
+ if (!locked)
+ mutex_enter(&xnbp->xnb_state_lock);
loop = xnbop->o_mca;
xnbop->o_mca = NULL;
- mutex_exit(&xnbp->xnb_state_lock);
+ if (!locked)
+ mutex_exit(&xnbp->xnb_state_lock);
while (loop != NULL) {
xmca_t *next = loop->next;