vhost: fix overflow on shadow used ring
authorTiwei Bie <tiwei.bie@intel.com>
Wed, 25 Jul 2018 13:51:37 +0000 (21:51 +0800)
committerTiwei Bie <tiwei.bie@intel.com>
Thu, 26 Jul 2018 08:02:50 +0000 (10:02 +0200)
commit14962a9c4f55b1a476246f279e999b555f78bbbe
tree1b79aabdf555302288225f5742912f8119f7cc3b
parent6e2fad861a6dd80d8dafe71ae14f87a30add7366
vhost: fix overflow on shadow used ring

The shadow used ring's size is the same as the vq's size,
so we shouldn't try more than "vq size" times. Besides,
the element pointed by avail->idx isn't available to the
device, so we will return error when try "vq size" times.

Fixes: 24e4844048e1 ("vhost: unify Rx mergeable and non-mergeable paths")
Fixes: a922401f35cc ("vhost: add Rx support for packed ring")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
lib/librte_vhost/virtio_net.c