diff options
author | gj <gj@FreeBSD.org> | 2001-12-30 09:27:28 +0000 |
---|---|---|
committer | gj <gj@FreeBSD.org> | 2001-12-30 09:27:28 +0000 |
commit | 3b3e08589b03552b648f4950664eb7822534a8fa (patch) | |
tree | 9165e9b336cd095a979269760b6936b342271161 /sys/i4b | |
parent | 63f2243d7991b37afaf5ce4bcaebc637bc140d17 (diff) | |
download | FreeBSD-src-3b3e08589b03552b648f4950664eb7822534a8fa.zip FreeBSD-src-3b3e08589b03552b648f4950664eb7822534a8fa.tar.gz |
Protect mtx_init() invocations with mtx_intialized() checks to avoid a
reported panic.
Submitted by: Alexander Leidinger <Alexander@Leidinger.net> (partly)
MFC after: 4 weeks
Diffstat (limited to 'sys/i4b')
-rw-r--r-- | sys/i4b/capi/capi_l4if.c | 6 | ||||
-rw-r--r-- | sys/i4b/capi/iavc/iavc_isa.c | 3 | ||||
-rw-r--r-- | sys/i4b/capi/iavc/iavc_pci.c | 3 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_ing.c | 9 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_ipr.c | 3 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_ispppsubr.c | 6 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_rbch.c | 3 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_trace.c | 3 | ||||
-rw-r--r-- | sys/i4b/layer1/ifpi/i4b_ifpi_pci.c | 12 | ||||
-rw-r--r-- | sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c | 12 | ||||
-rw-r--r-- | sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c | 6 | ||||
-rw-r--r-- | sys/i4b/layer1/ihfc/i4b_ihfc_drv.c | 6 | ||||
-rw-r--r-- | sys/i4b/layer1/isic/i4b_bchan.c | 6 | ||||
-rw-r--r-- | sys/i4b/layer1/iwic/i4b_iwic_bchan.c | 6 | ||||
-rw-r--r-- | sys/i4b/layer2/i4b_l2.c | 3 | ||||
-rw-r--r-- | sys/i4b/layer4/i4b_i4bdrv.c | 3 |
16 files changed, 60 insertions, 30 deletions
diff --git a/sys/i4b/capi/capi_l4if.c b/sys/i4b/capi/capi_l4if.c index 9cb05f2..5460ffb 100644 --- a/sys/i4b/capi/capi_l4if.c +++ b/sys/i4b/capi/capi_l4if.c @@ -240,8 +240,10 @@ capi_ll_attach(capi_softc_t *sc) sc->sc_bchan[i].rx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&sc->sc_bchan[i].tx_queue.ifq_mtx, "i4b_capi_tx", MTX_DEF); - mtx_init(&sc->sc_bchan[i].rx_queue.ifq_mtx, "i4b_capi_rx", MTX_DEF); + if(!mtx_initialized(&sc->sc_bchan[i].tx_queue.ifq_mtx)) + mtx_init(&sc->sc_bchan[i].tx_queue.ifq_mtx, "i4b_capi_tx", MTX_DEF); + if(!mtx_initialized(&sc->sc_bchan[i].rx_queue.ifq_mtx)) + mtx_init(&sc->sc_bchan[i].rx_queue.ifq_mtx, "i4b_capi_rx", MTX_DEF); #endif sc->sc_bchan[i].txcount = 0; diff --git a/sys/i4b/capi/iavc/iavc_isa.c b/sys/i4b/capi/iavc/iavc_isa.c index 96ea1c9..b4cfaba 100644 --- a/sys/i4b/capi/iavc/iavc_isa.c +++ b/sys/i4b/capi/iavc/iavc_isa.c @@ -225,7 +225,8 @@ iavc_isa_attach(device_t dev) sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_isa", MTX_DEF); + if(!mtx_initialized(&sc->sc_txq.ifq_mtx)) + mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_isa", MTX_DEF); #endif sc->sc_intr = FALSE; diff --git a/sys/i4b/capi/iavc/iavc_pci.c b/sys/i4b/capi/iavc/iavc_pci.c index 5579a3c..12de906 100644 --- a/sys/i4b/capi/iavc/iavc_pci.c +++ b/sys/i4b/capi/iavc/iavc_pci.c @@ -236,7 +236,8 @@ iavc_pci_attach(device_t dev) sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_pci", MTX_DEF); + if(!mtx_initialized(&sc->sc_txq.ifq_mtx)) + mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_pci", MTX_DEF); #endif sc->sc_intr = FALSE; diff --git a/sys/i4b/driver/i4b_ing.c b/sys/i4b/driver/i4b_ing.c index a430940..d9aca31 100644 --- a/sys/i4b/driver/i4b_ing.c +++ b/sys/i4b/driver/i4b_ing.c @@ -246,7 +246,8 @@ i4bingattach(void *dummy) sc->sc_state = ST_IDLE; sc->sc_fastq.ifq_maxlen = I4BINGMAXQLEN; - mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ing_fastq", MTX_DEF); + if(!mtx_initiallized(&sc->sc_fastq.ifq_mtx)) + mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ing_fastq", MTX_DEF); #if I4BINGACCT callout_handle_init(&sc->sc_callout); @@ -288,8 +289,10 @@ i4bingattach(void *dummy) sc->xmitq.ifq_maxlen = IFQ_MAXLEN; sc->xmitq_hipri.ifq_maxlen = IFQ_MAXLEN; - mtx_init(&sc->xmitq.ifq_mtx, "i4b_ing_xmitq", MTX_DEF); - mtx_init(&sc->xmitq_hipri.ifq_mtx, "i4b_ing_hipri", MTX_DEF); + if(!mtx_initialized(&sc->xmitq.ifq_mtx)) + mtx_init(&sc->xmitq.ifq_mtx, "i4b_ing_xmitq", MTX_DEF); + if(!mtx_initialized(&sc->xmitq_hipri.ifq_mtx)) + mtx_init(&sc->xmitq_hipri.ifq_mtx, "i4b_ing_hipri", MTX_DEF); } } diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c index fc5266f..8fae998 100644 --- a/sys/i4b/driver/i4b_ipr.c +++ b/sys/i4b/driver/i4b_ipr.c @@ -318,7 +318,8 @@ i4biprattach() sc->sc_fastq.ifq_maxlen = I4BIPRMAXQLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ipr_fastq", MTX_DEF); + if(!mtx_initialized(&sc->sc_fastq.ifq_mtx)) + mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ipr_fastq", MTX_DEF); #endif sc->sc_if.if_ipackets = 0; sc->sc_if.if_ierrors = 0; diff --git a/sys/i4b/driver/i4b_ispppsubr.c b/sys/i4b/driver/i4b_ispppsubr.c index b6f764e..f1cf2ba 100644 --- a/sys/i4b/driver/i4b_ispppsubr.c +++ b/sys/i4b/driver/i4b_ispppsubr.c @@ -955,8 +955,10 @@ isppp_attach(struct ifnet *ifp) sp->pp_cpq.ifq_maxlen = 20; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&sp->pp_fastq.ifq_mtx, "i4b_isppp_fastq", MTX_DEF); - mtx_init(&sp->pp_cpq.ifq_mtx, "i4b_isppp_cpq", MTX_DEF); + if(!mtx_initialized(&sp->pp_fastq.ifq_mtx)) + mtx_init(&sp->pp_fastq.ifq_mtx, "i4b_isppp_fastq", MTX_DEF); + if(!mtx_initialized(&sp->pp_cpq.ifq_mtx)) + mtx_init(&sp->pp_cpq.ifq_mtx, "i4b_isppp_cpq", MTX_DEF); #endif sp->pp_loopcnt = 0; diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index 29dce82..d701ec9 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -291,7 +291,8 @@ i4brbchattach() rbch_softc[i].sc_devstate = ST_IDLE; rbch_softc[i].sc_hdlcq.ifq_maxlen = I4BRBCHMAXQLEN; #if defined(__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&rbch_softc[i].sc_hdlcq.ifq_mtx, "i4b_rbch", MTX_DEF); + if(!mtx_initialized(&rbch_softc[i].sc_hdlcq.ifq_mtx)) + mtx_init(&rbch_softc[i].sc_hdlcq.ifq_mtx, "i4b_rbch", MTX_DEF); #endif rbch_softc[i].it_in.c_ispeed = rbch_softc[i].it_in.c_ospeed = 64000; termioschars(&rbch_softc[i].it_in); diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index 4a95094..81a5385 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -218,7 +218,8 @@ i4btrcattach() trace_queue[i].ifq_maxlen = IFQ_MAXLEN; #if __FreeBSD__ > 4 - mtx_init(&trace_queue[i].ifq_mtx, "i4b_trace", MTX_DEF); + if(!mtx_initialized(&trace_queue[i].ifq_mtx)) + mtx_init(&trace_queue[i].ifq_mtx, "i4b_trace", MTX_DEF); #endif device_state[i] = ST_IDLE; } diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c b/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c index 9244bda..d072b9c 100644 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c +++ b/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c @@ -651,11 +651,15 @@ avma1pp_attach_avma1pp(device_t dev) #if defined (__FreeBSD__) && __FreeBSD__ > 4 /* Init the channel mutexes */ chan = &sc->sc_chan[HSCX_CH_A]; - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", MTX_DEF); - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", MTX_DEF); + if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", MTX_DEF); chan = &sc->sc_chan[HSCX_CH_B]; - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", MTX_DEF); - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp_rx", MTX_DEF); + if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp_tx", MTX_DEF); #endif /* init the "HSCX" */ diff --git a/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c b/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c index 6ce760e5..f0bc413 100644 --- a/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c +++ b/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c @@ -581,11 +581,15 @@ avma1pp2_attach_avma1pp(device_t dev) #if defined (__FreeBSD__) && __FreeBSD__ > 4 /* Init the channel mutexes */ chan = &sc->sc_chan[HSCX_CH_A]; - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp2_rx", MTX_DEF); - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp2_tx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp2_rx", MTX_DEF); + if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp2_tx", MTX_DEF); chan = &sc->sc_chan[HSCX_CH_B]; - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp2_rx", MTX_DEF); - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp2_tx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avma1pp2_rx", MTX_DEF); + if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avma1pp2_tx", MTX_DEF); #endif /* init the "HSCX" */ diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c index d91f5e1..89c5550 100644 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c +++ b/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c @@ -1046,7 +1046,8 @@ avm_pnp_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avm_pnp_rx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_avm_pnp_rx", MTX_DEF); #endif i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ @@ -1064,7 +1065,8 @@ avm_pnp_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avm_pnp_tx", MTX_DEF); + if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_avm_pnp_tx", MTX_DEF); #endif i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c index 68afeaa..06254db 100644 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c +++ b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.c @@ -360,7 +360,8 @@ ihfc_init (ihfc_sc_t *sc, u_char chan, int prot, int activate) S_IFQUEUE.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&S_IFQUEUE.ifq_mtx, "i4b_ihfc", MTX_DEF); + if(!mtx_initialized(&S_IFQUEUE.ifq_mtx)) + mtx_init(&S_IFQUEUE.ifq_mtx, "i4b_ihfc", MTX_DEF); #endif if (!activate) continue; @@ -385,7 +386,8 @@ ihfc_init (ihfc_sc_t *sc, u_char chan, int prot, int activate) S_IFQUEUE.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&S_IFQUEUE.ifq_mtx, "i4b_ihfc", MTX_DEF); + if(!mtx_initialized(&S_IFQUEUE.ifq_mtx)) + mtx_init(&S_IFQUEUE.ifq_mtx, "i4b_ihfc", MTX_DEF); #endif S_PROT = prot; diff --git a/sys/i4b/layer1/isic/i4b_bchan.c b/sys/i4b/layer1/isic/i4b_bchan.c index 1226c17..2f520d8 100644 --- a/sys/i4b/layer1/isic/i4b_bchan.c +++ b/sys/i4b/layer1/isic/i4b_bchan.c @@ -90,7 +90,8 @@ isic_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_isic_rx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_isic_rx", MTX_DEF); #endif i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ @@ -108,7 +109,8 @@ isic_bchannel_setup(int unit, int h_chan, int bprot, int activate) chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_isic_tx", MTX_DEF); + if(!mtx_initialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_isic_tx", MTX_DEF); #endif i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ diff --git a/sys/i4b/layer1/iwic/i4b_iwic_bchan.c b/sys/i4b/layer1/iwic/i4b_iwic_bchan.c index 5e6948f..25cd1e2 100644 --- a/sys/i4b/layer1/iwic/i4b_iwic_bchan.c +++ b/sys/i4b/layer1/iwic/i4b_iwic_bchan.c @@ -435,7 +435,8 @@ iwic_bchannel_setup(int unit, int chan_no, int bprot, int activate) chan->rx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&chan->rx_queue.ifq_mtx, "i4b_iwic_rx", MTX_DEF); + if(!mtx_initialized(&chan->rx_queue.ifq_mtx)) + mtx_init(&chan->rx_queue.ifq_mtx, "i4b_iwic_rx", MTX_DEF); #endif i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */ @@ -453,7 +454,8 @@ iwic_bchannel_setup(int unit, int chan_no, int bprot, int activate) chan->tx_queue.ifq_maxlen = IFQ_MAXLEN; #if defined (__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&chan->tx_queue.ifq_mtx, "i4b_iwic_tx", MTX_DEF); + if(!mtx_initqialized(&chan->tx_queue.ifq_mtx)) + mtx_init(&chan->tx_queue.ifq_mtx, "i4b_iwic_tx", MTX_DEF); #endif i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */ diff --git a/sys/i4b/layer2/i4b_l2.c b/sys/i4b/layer2/i4b_l2.c index 0383812..96a4a15 100644 --- a/sys/i4b/layer2/i4b_l2.c +++ b/sys/i4b/layer2/i4b_l2.c @@ -277,7 +277,8 @@ i4b_mph_status_ind(int unit, int status, int parm) l2sc->i_queue.ifq_maxlen = IQUEUE_MAXLEN; #if defined(__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&l2sc->i_queue.ifq_mtx, "i4b_l2sc", MTX_DEF); + if(!mtx_initialized(&l2sc->i_queue.ifq_mtx)) + mtx_init(&l2sc->i_queue.ifq_mtx, "i4b_l2sc", MTX_DEF); #endif l2sc->ua_frame = NULL; bzero(&l2sc->stat, sizeof(lapdstat_t)); diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 41b3c57..6083e84 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -263,7 +263,8 @@ i4battach() i4b_rdqueue.ifq_maxlen = IFQ_MAXLEN; #if defined(__FreeBSD__) && __FreeBSD__ > 4 - mtx_init(&i4b_rdqueue.ifq_mtx, "i4b_rdqueue", MTX_DEF); + if(!mtx_initialized(&i4b_rdqueue.ifq_mtx)) + mtx_init(&i4b_rdqueue.ifq_mtx, "i4b_rdqueue", MTX_DEF); #endif #if defined(__FreeBSD__) |