From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: David Marchand <david.marchand@redhat.com>, dev@dpdk.org
Cc: chenbo.xia@intel.com, stable@dpdk.org,
Wenxiang Qian <leonwxqian@gmail.com>
Subject: Re: [PATCH 1/2] vhost: fix queue number check when setting inflight FD
Date: Thu, 10 Mar 2022 14:00:04 +0100 [thread overview]
Message-ID: <5339b9a8-581d-3428-5ec5-7edae9734960@redhat.com> (raw)
In-Reply-To: <20220310125059.30562-1-david.marchand@redhat.com>
On 3/10/22 13:50, David Marchand wrote:
> From: Chenbo Xia <chenbo.xia@intel.com>
>
> 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 and also make
> sure virtqueues are allocated before setting inflight information.
>
> Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information")
> Cc: stable@dpdk.org
>
> Reported-by: Wenxiang Qian <leonwxqian@gmail.com>
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---
> lib/vhost/vhost_user.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index 589b950458..1ec4357bee 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -2883,6 +2883,9 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev,
> case VHOST_USER_SET_VRING_ADDR:
> vring_idx = ctx->msg.payload.addr.index;
> break;
> + case VHOST_USER_SET_INFLIGHT_FD:
> + vring_idx = ctx->msg.payload.inflight.num_queues - 1;
> + break;
> default:
> return 0;
> }
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
prev parent reply other threads:[~2022-03-10 13:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 12:50 David Marchand
2022-03-10 12:50 ` [PATCH 2/2] vhost: fix FD leak with inflight messages David Marchand
2022-03-10 13:00 ` Maxime Coquelin
2022-03-10 15:32 ` David Marchand
2022-03-10 13:00 ` 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=5339b9a8-581d-3428-5ec5-7edae9734960@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=leonwxqian@gmail.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;
as well as URLs for NNTP newsgroup(s).