lkml.org 
[lkml]   [2021]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] virtio_vdpa: reject invalid vq indices
From
Date

在 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);

\
 
 \ /
  Last update: 2021-07-02 04:57    [W:0.044 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site