提交 22f7a4bf 编写于 作者: K Kunkun Jiang 提交者: Zheng Zengkai

vfio/pci: Fix wrong return value when get iommu attribute DOMAIN_ATTR_NESTING

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I46K8O
CVE: NA

------------------------

Some vendor IOMMU drivers doesn't implement their own domain_get_attr
callback or the processing of DOMAIN_ATTR_NESTING. Then
iommu_domain_get_attr may return an error. But it shouldn't affect the
result of vfio_pci_enable. We print a log to indicate the error and
return 0.
Signed-off-by: NKunkun Jiang <jiangkunkun@huawei.com>
Reviewed-by: NXinle Guo <guoxinle1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 742e5229
......@@ -502,8 +502,12 @@ static int vfio_pci_dma_fault_init(struct vfio_pci_device *vdev)
return 0;
ret = iommu_domain_get_attr(domain, DOMAIN_ATTR_NESTING, &nested);
if (ret || !nested)
return ret;
if (ret || !nested) {
if (ret)
pr_warn("%s: Get DOMAIN_ATTR_NESTING failed: %d.\n",
__func__, ret);
return 0;
}
mutex_init(&vdev->fault_queue_lock);
......@@ -592,8 +596,12 @@ static int vfio_pci_dma_fault_response_init(struct vfio_pci_device *vdev)
return 0;
ret = iommu_domain_get_attr(domain, DOMAIN_ATTR_NESTING, &nested);
if (ret || !nested)
return ret;
if (ret || !nested) {
if (ret)
pr_warn("%s: Get DOMAIN_ATTR_NESTING failed: %d.\n",
__func__, ret);
return 0;
}
mutex_init(&vdev->fault_response_queue_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册