Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jul 2019 18:21:01 +0000 (UTC)
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r349740 - stable/11/usr.sbin/bhyve
Message-ID:  <201907041821.x64IL1WB089037@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vmaffione
Date: Thu Jul  4 18:21:01 2019
New Revision: 349740
URL: https://svnweb.freebsd.org/changeset/base/349740

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
  Differential Revision:  https://reviews.freebsd.org/D20609

Modified:
  stable/11/usr.sbin/bhyve/pci_virtio_net.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/pci_virtio_net.c
==============================================================================
--- stable/11/usr.sbin/bhyve/pci_virtio_net.c	Thu Jul  4 18:20:02 2019	(r349739)
+++ stable/11/usr.sbin/bhyve/pci_virtio_net.c	Thu Jul  4 18:21:01 2019	(r349740)
@@ -580,10 +580,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907041821.x64IL1WB089037>