From: Chenbo Xia <chenbox@nvidia.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"david.marchand@redhat.com" <david.marchand@redhat.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [PATCH v2 1/3] vhost: fix virtqueue array size for control queue
Date: Fri, 16 Jan 2026 02:06:59 +0000 [thread overview]
Message-ID: <1BD79CB3-96A8-455F-BBEC-F5BC83629577@nvidia.com> (raw)
In-Reply-To: <20260114153445.2751895-2-maxime.coquelin@redhat.com>
> On Jan 14, 2026, at 23:34, Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
>
> External email: Use caution opening links or attachments
>
>
> When max_queue_pairs is set to VHOST_MAX_QUEUE_PAIRS (128), VDUSE
> calculates total_queues as max_queue_pairs * 2 + 1 = 257 to account
> for the control queue. However, the virtqueue array was sized as
> VHOST_MAX_QUEUE_PAIRS * 2, causing an out-of-bounds array access.
>
> Fix by defining VHOST_MAX_VRING to explicitly account for the control
> queue (VHOST_MAX_QUEUE_PAIRS * 2 + 1) and using it for the virtqueue
> array size.
>
> Fixes: f0a37cc6a1e2 ("vhost: add multiqueue support to VDUSE")
> Cc: stable@dpdk.org
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> ---
> lib/vhost/vhost.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
> index e9e71c1707..ee61f7415e 100644
> --- a/lib/vhost/vhost.h
> +++ b/lib/vhost/vhost.h
> @@ -261,8 +261,9 @@ struct vhost_async {
> };
>
> #define VHOST_RECONNECT_VERSION 0x0
> -#define VHOST_MAX_VRING 0x100
> #define VHOST_MAX_QUEUE_PAIRS 0x80
> +/* Max vring count: 2 per queue pair plus 1 control queue */
> +#define VHOST_MAX_VRING (VHOST_MAX_QUEUE_PAIRS * 2 + 1)
>
> struct __rte_cache_aligned vhost_reconnect_vring {
> uint16_t last_avail_idx;
> @@ -501,7 +502,7 @@ struct __rte_cache_aligned virtio_net {
>
> int extbuf;
> int linearbuf;
> - struct vhost_virtqueue *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
> + struct vhost_virtqueue *virtqueue[VHOST_MAX_VRING];
>
> rte_rwlock_t iotlb_pending_lock;
> struct vhost_iotlb_entry *iotlb_pool;
> --
> 2.52.0
>
Reviewed-by: Chenbo Xia <chenbox@nvidia.com>
next prev parent reply other threads:[~2026-01-16 2:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 15:34 [PATCH v2 0/3] vhost: VDUSE-related fixes Maxime Coquelin
2026-01-14 15:34 ` [PATCH v2 1/3] vhost: fix virtqueue array size for control queue Maxime Coquelin
2026-01-16 2:06 ` Chenbo Xia [this message]
2026-01-14 15:34 ` [PATCH v2 2/3] vhost: fix descriptor chain bounds check in " Maxime Coquelin
2026-01-15 9:11 ` David Marchand
2026-01-16 3:10 ` Chenbo Xia
2026-01-14 15:34 ` [PATCH v2 3/3] vhost: fix mmap error check in VDUSE IOTLB miss handler Maxime Coquelin
2026-01-16 3:11 ` Chenbo Xia
2026-01-14 17:53 ` [PATCH v2 0/3] vhost: VDUSE-related fixes Stephen Hemminger
2026-01-26 19:37 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1BD79CB3-96A8-455F-BBEC-F5BC83629577@nvidia.com \
--to=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox