summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-12-16 18:03:18 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-12-16 18:03:18 +0000
commitefd9ad2cb3ac2a3838d00a3017fadef949848d41 (patch)
tree5e2a08f1d1ca8205f01e1d55d56651d342e7c4b1 /sys
parent6b92002734576c7621a3af511282401d9b917cdc (diff)
Protect memory allocation and disposal with splvm(); gets rid of splassert
complaints during boot on i386. ok stsp@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/bwi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c
index e526f2837ff..30c62383d1f 100644
--- a/sys/dev/ic/bwi.c
+++ b/sys/dev/ic/bwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwi.c,v 1.110 2014/09/14 14:17:24 jsg Exp $ */
+/* $OpenBSD: bwi.c,v 1.111 2014/12/16 18:03:17 miod Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -909,7 +909,7 @@ bwi_detach(void *arg)
{
struct bwi_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ic.ic_if;
- int i;
+ int s, i;
bwi_stop(sc, 1);
ieee80211_ifdetach(ifp);
@@ -918,7 +918,9 @@ bwi_detach(void *arg)
for (i = 0; i < sc->sc_nmac; ++i)
bwi_mac_detach(&sc->sc_mac[i]);
+ s = splvm();
bwi_dma_free(sc);
+ splx(s);
bwi_dma_mbuf_destroy(sc, BWI_TX_NRING, 1);
return (0);
@@ -7533,6 +7535,7 @@ bwi_dma_alloc(struct bwi_softc *sc)
int error, i, has_txstats;
bus_size_t tx_ring_sz, rx_ring_sz, desc_sz = 0;
uint32_t txrx_ctrl_step = 0;
+ int s;
has_txstats = 0;
for (i = 0; i < sc->sc_nmac; ++i) {
@@ -7604,6 +7607,8 @@ bwi_dma_alloc(struct bwi_softc *sc)
tx_ring_sz = roundup(desc_sz * BWI_TX_NDESC, BWI_RING_ALIGN);
rx_ring_sz = roundup(desc_sz * BWI_RX_NDESC, BWI_RING_ALIGN);
+ s = splvm();
+
#define TXRX_CTRL(idx) (BWI_TXRX_CTRL_BASE + (idx) * txrx_ctrl_step)
/*
* Create TX ring DMA stuffs
@@ -7615,6 +7620,7 @@ bwi_dma_alloc(struct bwi_softc *sc)
printf("%s: %dth TX ring DMA alloc failed\n",
sc->sc_dev.dv_xname, i);
bwi_dma_free(sc);
+ splx(s);
return (error);
}
}
@@ -7627,6 +7633,7 @@ bwi_dma_alloc(struct bwi_softc *sc)
if (error) {
printf("%s: RX ring DMA alloc failed\n", sc->sc_dev.dv_xname);
bwi_dma_free(sc);
+ splx(s);
return (error);
}
@@ -7636,6 +7643,7 @@ bwi_dma_alloc(struct bwi_softc *sc)
printf("%s: TX stats DMA alloc failed\n",
sc->sc_dev.dv_xname);
bwi_dma_free(sc);
+ splx(s);
return (error);
}
}
@@ -7648,6 +7656,8 @@ bwi_dma_alloc(struct bwi_softc *sc)
if (error)
bwi_dma_free(sc);
+ splx(s);
+
return (error);
}