[dpdk-stable] [PATCH 4/6] vhost: fix possible out of bound access in vector filling

Tiwei Bie tiwei.bie at intel.com
Fri Jan 4 05:06:40 CET 2019


Fixes: 7f74b95c444f ("vhost: pre update used ring for Tx and Rx")
Cc: stable at dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie at intel.com>
---
 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 474acf64d..d64c355b9 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -312,6 +312,9 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	struct vring_desc *descs = vq->desc;
 	struct vring_desc *idesc = NULL;
 
+	if (unlikely(idx >= vq->size))
+		return -1;
+
 	*desc_chain_head = idx;
 
 	if (vq->desc[idx].flags & VRING_DESC_F_INDIRECT) {
-- 
2.17.1



More information about the stable mailing list