summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiong Weimin <xiongweimin@kylinos.cn>2026-08-06 08:58:09 +0800
committerMichael S. Tsirkin <mst@redhat.com>2026-09-07 18:54:02 -0400
commit6601d5a00899e7fa7e6b2d18113cee385ed3801b (patch)
treece7dda6bf1c2d67cb48010a4aa90232afa096895
parentd14d693adb055e98ca705822ba6daebc18602d9a (diff)
vdpa/pds: check virtqueue notify mapping
vp_modern_map_vq_notify() can fail and return NULL. Check the notify mapping while adding a pds vDPA device and use the existing teardown path instead of storing a NULL doorbell pointer in the virtqueue state. Signed-off-by: Xiong Weimin <xiongweimin@kylinos.cn> Reviewed-by: Brett Creeley <brett.creeley@amd.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260806005809.1875257-1-xiongweimin@kylinos.cn>
-rw-r--r--drivers/vdpa/pds/vdpa_dev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/vdpa/pds/vdpa_dev.c b/drivers/vdpa/pds/vdpa_dev.c
index 43426bd971ac..77d679f6763d 100644
--- a/drivers/vdpa/pds/vdpa_dev.c
+++ b/drivers/vdpa/pds/vdpa_dev.c
@@ -731,6 +731,12 @@ static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
notify = vp_modern_map_vq_notify(&pdsv->vdpa_aux->vd_mdev,
i, &pdsv->vqs[i].notify_pa);
+ if (!notify) {
+ err = -EINVAL;
+ dev_err(dev, "Fail to map vq notify %d\n", i);
+ goto err_unmap;
+ }
+
pds_vdpa_init_vqs_entry(pdsv, i, notify);
}