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>
This commit is contained in:
Xiong Weimin 2026-08-06 08:58:09 +08:00 committed by Michael S. Tsirkin
parent d14d693adb
commit 6601d5a008

View File

@ -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);
}