From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com
Subject: Re: [PATCH] net/virtio-user: fix control queue allocation for non-vDPA
Date: Fri, 5 Jul 2024 09:50:15 +0200 [thread overview]
Message-ID: <bd3ca1d0-e7ce-4b20-9b16-06ff53ec8dce@redhat.com> (raw)
In-Reply-To: <20240703162738.283162-1-maxime.coquelin@redhat.com>
On 7/3/24 18:27, Maxime Coquelin wrote:
> For non-vDPA backends, where the backend does not support
> control queue, it is still emulated in the Virtio-user
> layer to handle multiqueue feature. The frontend setups a
> control queue, which is hidden to the device. It means the
> number of vrings metadata to allocate should be based on
> the frontend features and not the device features.
>
> This patch fixes out-of-range access reported by ASan,
> which could sometimes be noticed at exit time by a
> segmentation fault when disabled:
>
> Fixes: b80947743f5e ("net/virtio-user: fix control queue allocation")
>
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index b2c6c2b7df..fed66d2ae9 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -624,7 +624,7 @@ virtio_user_alloc_vrings(struct virtio_user_dev *dev)
> bool packed_ring = !!(dev->device_features & (1ull << VIRTIO_F_RING_PACKED));
>
> nr_vrings = dev->max_queue_pairs * 2;
> - if (dev->device_features & (1ull << VIRTIO_NET_F_CTRL_VQ))
> + if (dev->frontend_features & (1ull << VIRTIO_NET_F_CTRL_VQ))
> nr_vrings++;
>
> dev->callfds = rte_zmalloc("virtio_user_dev", nr_vrings * sizeof(*dev->callfds), 0);
Applied to next-virtio/for-next-net.
Thanks for the review,
Maxime
prev parent reply other threads:[~2024-07-05 7:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 16:27 Maxime Coquelin
2024-07-04 9:25 ` David Marchand
2024-07-05 7:50 ` Maxime Coquelin [this message]
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=bd3ca1d0-e7ce-4b20-9b16-06ff53ec8dce@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@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;
as well as URLs for NNTP newsgroup(s).