[PATCH] vhost: fix queue number check when setting inflight FD

Xia, Chenbo chenbo.xia at intel.com
Wed Feb 16 03:18:39 CET 2022


It's mistake.. please ignore the patch. Sorry for the noise

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia at intel.com>
> Sent: Wednesday, February 16, 2022 9:53 AM
> To: Xia, Chenbo <chenbo.xia at intel.com>
> Cc: stable at dpdk.org
> Subject: [PATCH] vhost: fix queue number check when setting inflight FD
> 
> In function vhost_user_set_inflight_fd, queue number in inflight
> message is used to access virtqueue. However, queue number could
> be larger than VHOST_MAX_VRING and cause write OOB as this number
> will be used to write inflight info in virtqueue structure. This
> patch checks the queue number to avoid the issue.
> 
> Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information")
> Cc: stable at dpdk.org
> 
> Reported-by: Wenxiang Qian <leonwxqian at gmail.com>
> Signed-off-by: Chenbo Xia <chenbo.xia at intel.com>
> ---
>  lib/vhost/vhost_user.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 1d3f89afd8..b20addd125 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -1718,6 +1718,12 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,
>  	num_queues = ctx->msg.payload.inflight.num_queues;
>  	queue_size = ctx->msg.payload.inflight.queue_size;
> 
> +	if (num_queues > VHOST_MAX_VRING) {
> +		VHOST_LOG_CONFIG(ERR, "(%s) invalid inflight queue num: %u\n",
> +			dev->ifname, num_queues);
> +		return RTE_VHOST_MSG_RESULT_ERR;
> +	}
> +
>  	if (vq_is_packed(dev))
>  		pervq_inflight_size = get_pervq_shm_size_packed(queue_size);
>  	else
> --
> 2.17.1



More information about the stable mailing list