summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-02-25 07:03:10 +0000
committersephe <sephe@FreeBSD.org>2016-02-25 07:03:10 +0000
commita9e53514f10ae3c5a2aaad205f978f9a6787fcf4 (patch)
tree9077b71c891c16db7f592043482b76d4ec84f5bd
parent34284c5396d89b7b76aeccb27ae6e2a2e46c9936 (diff)
downloadFreeBSD-src-a9e53514f10ae3c5a2aaad205f978f9a6787fcf4.zip
FreeBSD-src-a9e53514f10ae3c5a2aaad205f978f9a6787fcf4.tar.gz
hyperv/hn: Hold the TX ring lock then drain TX desc buf_ring
Reported by: Hongxiong Xian <v-hoxian microsoft com> MFC after: 1 week Sponsored by: Microsoft OSTC
-rw-r--r--sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
index 5d32648..ce61fac 100644
--- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -2326,8 +2326,10 @@ hn_destroy_tx_ring(struct hn_tx_ring *txr)
hn_txdesc_dmamap_destroy(txd);
}
#else
+ mtx_lock(&txr->hn_tx_lock);
while ((txd = buf_ring_dequeue_sc(txr->hn_txdesc_br)) != NULL)
hn_txdesc_dmamap_destroy(txd);
+ mtx_unlock(&txr->hn_tx_lock);
#endif
if (txr->hn_tx_data_dtag != NULL)
OpenPOWER on IntegriCloud