linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: kernel@axis.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] virtio_vdpa: reject invalid vq indices
Date: Fri, 2 Jul 2021 10:49:18 +0800	[thread overview]
Message-ID: <8e6a6793-39a3-0478-c574-5d3d641f2310@redhat.com> (raw)
In-Reply-To: <20210701114652.21956-1-vincent.whitchurch@axis.com>


在 2021/7/1 下午7:46, Vincent Whitchurch 写道:
> Do not call vDPA drivers' callbacks with vq indicies larger than what
> the drivers indicate that they support.  vDPA drivers do not bounds
> check the indices.
>
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   drivers/virtio/virtio_vdpa.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> index e28acf482e0c..e9b9dd03f44a 100644
> --- a/drivers/virtio/virtio_vdpa.c
> +++ b/drivers/virtio/virtio_vdpa.c
> @@ -149,6 +149,9 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
>   	if (!name)
>   		return NULL;
>   
> +	if (index >= vdpa->nvqs)
> +		return ERR_PTR(-ENOENT);
> +
>   	/* Queue shouldn't already be set up. */
>   	if (ops->get_vq_ready(vdpa, index))
>   		return ERR_PTR(-ENOENT);


  reply	other threads:[~2021-07-02  3:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 11:46 Vincent Whitchurch
2021-07-02  2:49 ` Jason Wang [this message]
2021-07-05 15:51 ` Stefano Garzarella

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=8e6a6793-39a3-0478-c574-5d3d641f2310@redhat.com \
    --to=jasowang@redhat.com \
    --cc=kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=vincent.whitchurch@axis.com \
    --cc=virtualization@lists.linux-foundation.org \
    --subject='Re: [PATCH] virtio_vdpa: reject invalid vq indices' \
    /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

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).