Author: vmaffione
Date: Tue Jun 18 17:51:30 2019
New Revision: 349175
URL: https://svnweb.freebsd.org/changeset/base/349175

Log:
  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

Modified:
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_net.c        Tue Jun 18 17:05:05 2019        
(r349174)
+++ head/usr.sbin/bhyve/pci_virtio_net.c        Tue Jun 18 17:51:30 2019        
(r349175)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to