aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-01-12 18:34:24 +0100
committerDamjan Marion <damarion@cisco.com>2016-01-12 18:38:11 +0100
commit920ecc2e1ff2f1bdbd3698243cd1804b4bc2e269 (patch)
tree9be280ae7ef793721ab6beb8ef64b53a3993e637 /vnet
parent3b566bb613ff918e5a016a190cb2efcfdea02f5f (diff)
Avoid crash in vhost-user driver when running multithreaded
Change-Id: Ib54575453fd26ba1a7256e9d583c8f8532613ebc Signed-off-by: Carsten Koester <ckoester@cisco.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c
index 20a4c021c6a..8dca33b82af 100644
--- a/vnet/vnet/devices/virtio/vhost-user.c
+++ b/vnet/vnet/devices/virtio/vhost-user.c
@@ -771,6 +771,9 @@ static u32 vhost_user_if_input ( vlib_main_t * vm,
if (PREDICT_FALSE(!txvq->desc))
return 0;
+ if (PREDICT_FALSE(!txvq->avail))
+ return 0;
+
/* do we have pending intterupts ? */
if ((txvq->n_since_last_int) && (txvq->int_deadline < now))
vhost_user_send_call(vm, txvq);
@@ -1037,6 +1040,9 @@ vhost_user_intfc_tx (vlib_main_t * vm,
if (PREDICT_FALSE(!rxvq->desc))
goto done2;
+ if (PREDICT_FALSE(!rxvq->avail))
+ goto done2;
+
if (PREDICT_FALSE(vui->lockp != 0))
{
while (__sync_lock_test_and_set (vui->lockp, 1))