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: sta...@dpdk.org Signed-off-by: Maxime Coquelin <maxime.coque...@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