summaryrefslogtreecommitdiff
path: root/drivers/virtio/virtio_vdpa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio/virtio_vdpa.c')
-rw-r--r--drivers/virtio/virtio_vdpa.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index e1a141135992..72eaef2caeb1 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -151,6 +151,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);