summaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorDragos Tatulea <dtatulea@nvidia.com>2023-05-04 15:50:52 +0200
committerMichael S. Tsirkin <mst@redhat.com>2023-06-27 16:47:08 +0200
commitfe37efba475375caa2dbc71cb06f53f7086277ef (patch)
treea7001d38b369005b13e40ed27048df96b7bb6a0e /drivers/virtio
parentvdpa/snet: implement the resume vDPA callback (diff)
downloadlinux-fe37efba475375caa2dbc71cb06f53f7086277ef.tar.xz
linux-fe37efba475375caa2dbc71cb06f53f7086277ef.zip
virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
The referenced patch calls set_vq_affinity without checking if the op is valid. This patch adds the check. Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism") Reviewed-by: Gal Pressman <gal@nvidia.com> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com> Message-Id: <20230504135053.2283816-1-dtatulea@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Feng Liu <feliu@nvidia.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_vdpa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index eb6aee8c06b2..989e2d7184ce 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
err = PTR_ERR(vqs[i]);
goto err_setup_vq;
}
- ops->set_vq_affinity(vdpa, i, &masks[i]);
+
+ if (ops->set_vq_affinity)
+ ops->set_vq_affinity(vdpa, i, &masks[i]);
}
cb.callback = virtio_vdpa_config_cb;