bhyve: vtnet: fix locking on receive

The vsc_rx_ready and the RX virtqueue is protected by the rx_mtx lock.
However, pci_vtnet_ping_rxq() (currently called only once after each
device reset) accesses those without acquiring the lock.

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20609
This commit is contained in:
Vincenzo Maffione 2019-06-18 17:51:30 +00:00
parent edd96b9fb9
commit 5c2b348a54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349175

View File

@ -583,10 +583,12 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq)
/*
* A qnotify means that the rx process can now begin
*/
pthread_mutex_lock(&sc->rx_mtx);
if (sc->vsc_rx_ready == 0) {
sc->vsc_rx_ready = 1;
vq_kick_disable(vq);
}
pthread_mutex_unlock(&sc->rx_mtx);
}
static void