From: Patrick Fu Date: Tue, 21 Jul 2020 03:35:57 +0000 (+0800) Subject: vhost: fix missing virtqueue status check in async path X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5c7ddd6b14eddeb540cc28d0fc8b5d411f9d7661;p=dpdk.git vhost: fix missing virtqueue status check in async path Vring should not be touched if vq is disabled. This patch adds the vq status check in async enqueue polling to avoid accessing to a disabled queue. Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 235c31e288..62a5965fc4 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1689,9 +1689,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, if (n_pkts_put) { vq->async_pkts_inflight_n -= n_pkts_put; - __atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE); - - vhost_vring_call_split(dev, vq); + if (likely(vq->enabled && vq->access_ok)) { + __atomic_add_fetch(&vq->used->idx, + n_descs, __ATOMIC_RELEASE); + vhost_vring_call_split(dev, vq); + } } if (start_idx + n_pkts_put <= vq_size) {