vhost: crash in vhost_user_tx_avx2
[vpp.git] / src / vnet / devices / virtio / vhost_user_output.c
index 8205949..9b6c017 100644 (file)
@@ -261,6 +261,12 @@ VNET_DEVICE_CLASS_TX_FN (vhost_user_device_class) (vlib_main_t * vm,
     VHOST_VRING_IDX_RX (*vec_elt_at_index
                        (vui->per_cpu_tx_qid, thread_index));
   rxvq = &vui->vrings[qid];
+  if (PREDICT_FALSE (rxvq->avail == 0))
+    {
+      error = VHOST_USER_TX_FUNC_ERROR_MMAP_FAIL;
+      goto done3;
+    }
+
   if (PREDICT_FALSE (vui->use_tx_spinlock))
     vhost_user_vring_lock (vui, qid);