summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coquelin <maxime.coquelin@redhat.com>2016-07-25 16:09:58 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-07-25 17:55:12 +0200
commitb7aabd7a87cee66ec3c8e010ee45e0ca70d0d914 (patch)
tree24140d8ca9c8c880d5d8618d4200710ceb8c4dba
parent20d159f2054383c46529e301aac723a823c670cb (diff)
downloaddpdk-b7aabd7a87cee66ec3c8e010ee45e0ca70d0d914.zip
dpdk-b7aabd7a87cee66ec3c8e010ee45e0ca70d0d914.tar.gz
dpdk-b7aabd7a87cee66ec3c8e010ee45e0ca70d0d914.tar.xz
vhost: fix off-by-one error on descriptor number check
nr_desc is not an index but the number of descriptors, so can be equal to the virtqueue size. Fixes: a436f53ebfeb ("vhost: avoid dead loop chain") Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
-rw-r--r--lib/librte_vhost/vhost_rxtx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index bc00518..08a73fd 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -748,7 +748,7 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
break;
if (unlikely(desc->next >= vq->size ||
- ++nr_desc >= vq->size))
+ ++nr_desc > vq->size))
return -1;
desc = &vq->desc[desc->next];