* [PATCH] virtio_vdpa: reject invalid vq indices
@ 2021-07-01 11:46 ` Vincent Whitchurch
0 siblings, 0 replies; 6+ messages in thread
From: Vincent Whitchurch @ 2021-07-01 11:46 UTC (permalink / raw)
To: Michael S. Tsirkin, Jason Wang
Cc: kernel, Vincent Whitchurch, virtualization, linux-kernel
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>
---
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);
--
2.28.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] virtio_vdpa: reject invalid vq indices
@ 2021-07-01 11:46 ` Vincent Whitchurch
0 siblings, 0 replies; 6+ messages in thread
From: Vincent Whitchurch @ 2021-07-01 11:46 UTC (permalink / raw)
To: Michael S. Tsirkin, Jason Wang
Cc: Vincent Whitchurch, kernel, linux-kernel, virtualization
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>
---
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);
--
2.28.0
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio_vdpa: reject invalid vq indices
2021-07-01 11:46 ` Vincent Whitchurch
@ 2021-07-02 2:49 ` Jason Wang
-1 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2021-07-02 2:49 UTC (permalink / raw)
To: Vincent Whitchurch, Michael S. Tsirkin
Cc: kernel, virtualization, linux-kernel
在 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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio_vdpa: reject invalid vq indices
@ 2021-07-02 2:49 ` Jason Wang
0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2021-07-02 2:49 UTC (permalink / raw)
To: Vincent Whitchurch, Michael S. Tsirkin
Cc: kernel, linux-kernel, virtualization
在 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);
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio_vdpa: reject invalid vq indices
2021-07-01 11:46 ` Vincent Whitchurch
@ 2021-07-05 15:51 ` Stefano Garzarella
-1 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2021-07-05 15:51 UTC (permalink / raw)
To: Vincent Whitchurch
Cc: Michael S. Tsirkin, Jason Wang, kernel, virtualization, linux-kernel
On Thu, Jul 01, 2021 at 01:46:52PM +0200, Vincent Whitchurch wrote:
>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>
>---
> 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);
>--
>2.28.0
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio_vdpa: reject invalid vq indices
@ 2021-07-05 15:51 ` Stefano Garzarella
0 siblings, 0 replies; 6+ messages in thread
From: Stefano Garzarella @ 2021-07-05 15:51 UTC (permalink / raw)
To: Vincent Whitchurch
Cc: virtualization, kernel, linux-kernel, Michael S. Tsirkin
On Thu, Jul 01, 2021 at 01:46:52PM +0200, Vincent Whitchurch wrote:
>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>
>---
> 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);
>--
>2.28.0
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-07-05 15:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 11:46 [PATCH] virtio_vdpa: reject invalid vq indices Vincent Whitchurch
2021-07-01 11:46 ` Vincent Whitchurch
2021-07-02 2:49 ` Jason Wang
2021-07-02 2:49 ` Jason Wang
2021-07-05 15:51 ` Stefano Garzarella
2021-07-05 15:51 ` Stefano Garzarella
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.