Re: [RFC v4 7/8] hisi_acc_vfio_pci: Add support for VFIO live migration

From: Alex Williamson
Date: Wed Feb 09 2022 - 20:55:53 EST


On Tue, 8 Feb 2022 13:34:24 +0000
Shameer Kolothum <shameerali.kolothum.thodi@xxxxxxxxxx> wrote:
> +
> +static struct hisi_acc_vf_migration_file *
> +hisi_acc_vf_stop_copy(struct hisi_acc_vf_core_device *hisi_acc_vdev)
> +{
> + struct hisi_qm *vf_qm = &hisi_acc_vdev->vf_qm;
> + struct device *dev = &hisi_acc_vdev->vf_dev->dev;
> + struct hisi_acc_vf_migration_file *migf;
> + int ret;
> +
> + if (unlikely(qm_wait_dev_not_ready(vf_qm))) {
> + dev_info(dev, "QM device not ready, no data to transfer\n");
> + return 0;
> + }

This return value looks suspicious and I think would cause a segfault
in the calling code:

+ migf = hisi_acc_vf_stop_copy(hisi_acc_vdev);
+ if (IS_ERR(migf))
+ return ERR_CAST(migf);
+ get_file(migf->filp);
+ hisi_acc_vdev->saving_migf = migf;
+ return migf->filp;

Thanks,
Alex