[PATCH 6.19 342/844] hisi_acc_vfio_pci: fix the queue parameter anomaly issue
From: Sasha Levin
Date: Sat Feb 28 2026 - 13:39:04 EST
From: Longfang Liu <liulongfang@xxxxxxxxxx>
[ Upstream commit c3cbc276c2a33b04fc78a86cdb2ddce094cb3614 ]
When the number of QPs initialized by the device, as read via vft, is zero,
it indicates either an abnormal device configuration or an abnormal read
result.
Returning 0 directly in this case would allow the live migration operation
to complete successfully, leading to incorrect parameter configuration after
migration and preventing the service from recovering normal functionality.
Therefore, in such situations, an error should be returned to roll back the
live migration operation.
Signed-off-by: Longfang Liu <liulongfang@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20260122020205.2884497-5-liulongfang@xxxxxxxxxx
Signed-off-by: Alex Williamson <alex@xxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index 8a05fb91929fb..2b8ac97cef2d2 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -426,7 +426,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
ret = qm_get_vft(vf_qm, &vf_qm->qp_base);
if (ret <= 0) {
dev_err(dev, "failed to get vft qp nums\n");
- return ret;
+ return ret < 0 ? ret : -EINVAL;
}
if (ret != vf_data->qp_num) {
--
2.51.0