From c197bf4fe1981589b16a1e4dac8b447238c92ccb Mon Sep 17 00:00:00 2001 From: David C Somayajulu Date: Tue, 23 Jun 2015 20:09:52 +0000 Subject: [PATCH] tx_mtx should be grabbed before calling buf_ring_dequeue_sc() Submitted by:Attilio.Rao@isilon.com MFC after:5 days --- sys/dev/bxe/bxe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c index 0b26d315ff82..f3e59640fb84 100644 --- a/sys/dev/bxe/bxe.c +++ b/sys/dev/bxe/bxe.c @@ -6547,10 +6547,14 @@ bxe_free_fp_buffers(struct bxe_softc *sc) #if __FreeBSD_version >= 800000 if (fp->tx_br != NULL) { - struct mbuf *m; /* just in case bxe_mq_flush() wasn't called */ - while ((m = buf_ring_dequeue_sc(fp->tx_br)) != NULL) { - m_freem(m); + if (mtx_initialized(&fp->tx_mtx)) { + struct mbuf *m; + + BXE_FP_TX_LOCK(fp); + while ((m = buf_ring_dequeue_sc(fp->tx_br)) != NULL) + m_freem(m); + BXE_FP_TX_UNLOCK(fp); } buf_ring_free(fp->tx_br, M_DEVBUF); fp->tx_br = NULL;