From: Li Feng Date: Thu, 14 Oct 2021 12:40:08 +0000 (+0800) Subject: vhost: add sanity check on inflight last index X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5a4fbe79e6d124141bd0a820c897287b15c559c4;p=dpdk.git vhost: add sanity check on inflight last index The index in rte_vhost_set_last_inflight_io_split is from the frontend driver, check if it's in the virtqueue range. Fixes: bb0c2de9602b ("vhost: add APIs to operate inflight ring") Cc: stable@dpdk.org Signed-off-by: Li Feng Reviewed-by: Maxime Coquelin --- diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 9540522dac..3b674ac320 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -1226,6 +1226,9 @@ rte_vhost_set_last_inflight_io_split(int vid, uint16_t vring_idx, if (unlikely(!vq->inflight_split)) return -1; + if (unlikely(idx >= vq->size)) + return -1; + vq->inflight_split->last_inflight_io = idx; return 0; }