[PATCH 5/7] vhost: Fix check on virtqueue access in in-flight getter
Maxime Coquelin
maxime.coquelin at redhat.com
Mon Sep 25 18:36:08 CEST 2023
Acquiring the access lock is not enough to ensure
virtqueue's metadata such as vring pointers are valid.
The access status must also be checked.
Fixes: 0c0935c5f794 ("vhost: allow to check in-flight packets for async vhost")
Cc: stable at dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
lib/vhost/vhost.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 7f5d25255a..51383410bf 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -2069,9 +2069,15 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
return ret;
}
+ if (unlikely(!vq->access_ok)) {
+ ret = -1;
+ goto out_unlock;
+ }
+
if (vq->async)
ret = vq->async->pkts_inflight_n;
+out_unlock:
rte_rwlock_write_unlock(&vq->access_lock);
return ret;
--
2.41.0
More information about the stable
mailing list