vhost: validate index in available entries API
This patch validates the queue index parameter, in order
to ensure neither out-of-bound accesses nor NULL pointer
dereferencing happen.
Fixes: a67f286a65
("vhost: export queue free entries")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
This commit is contained in:
parent
8acd7c2133
commit
8c042f8191
@ -1260,7 +1260,12 @@ rte_vhost_avail_entries(int vid, uint16_t queue_id)
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
if (queue_id >= VHOST_MAX_VRING)
|
||||
return 0;
|
||||
|
||||
vq = dev->virtqueue[queue_id];
|
||||
if (!vq)
|
||||
return 0;
|
||||
|
||||
rte_spinlock_lock(&vq->access_lock);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user