vhost: fix index overflow for packed ring in async vhost
authorCheng Jiang <cheng1.jiang@intel.com>
Thu, 15 Jul 2021 09:50:30 +0000 (09:50 +0000)
committerChenbo Xia <chenbo.xia@intel.com>
Wed, 21 Jul 2021 05:56:13 +0000 (07:56 +0200)
commit8d2c1260aff404767f7fa61508b864de81e95ce0
tree96c37ecdf15166771f4182c8d1177ec161094ebb
parent706ba48665844b859fcf0bd9526ec5da28b915da
vhost: fix index overflow for packed ring in async vhost

We introduced some new indexes in packed ring of async vhost. They
will eventually overflow and lead to errors if the ring size is not
a power of 2. This patch is to check and keep these indexes within a
reasonable range.

Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath")
Cc: stable@dpdk.org
Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
lib/vhost/virtio_net.c