virtio_vdpa: reject invalid vq indices
PATCH 1/1 virtio_vdpa: reject invalid vq indices
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.
--- drivers/virtio/virtio_vdpa.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/virtio/virtio_vdpa.c +3 -0
@@ -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 );
Signature · 1 line
2.28.0
Quoted 5 lines · 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 <[email protected]>
Quoted 9 lines
--- drivers/virtio/virtio_vdpa.c | 3 +++ 1 file changed, 3 insertions(+)drivers/virtio/virtio_vdpa.c +0
-0
drivers/virtio/virtio_vdpa.c virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index, · line 157
Quoted 9 lines
drivers/virtio/virtio_vdpa.c +3
-0@@ -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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 26 lines · 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 <[email protected]>---
drivers/virtio/virtio_vdpa.c| 3 +++1 file changed, 3 insertions(+)drivers/virtio/virtio_vdpa.c +3
-0@@ -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 );Signature · 1 line
2.28.0