[dpdk-stable] [dpdk-dev] [PATCH v2] vhost: add sanity check when operating the split ring
Maxime Coquelin
maxime.coquelin at redhat.com
Fri Oct 15 10:51:54 CEST 2021
The title is too vague, I would put something like:
vhost: add sanity check on inflight last index
On 10/14/21 14:40, Li Feng wrote:
> The idx in rte_vhost_set_last_inflight_io_split is from the frontend
s/idx/index/
> driver, check if it's in the virtqueue range.
>
> Fixes: bb0c2de9602b ("vhost: add APIs to operate inflight ring")
> Cc: stable at dpdk.org
>
> Signed-off-by: Li Feng <fengli at smartx.com>
> ---
> lib/vhost/vhost.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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;
> }
>
Other than that, this is fine to me:
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
If my suggestions are fine for you, I can fix while applying.
Thanks,
Maxime
More information about the stable
mailing list