From: Wei Yongjun Date: Thu, 9 Feb 2017 16:01:58 +0000 (+0000) Subject: vfio/type1: Fix error return code in vfio_iommu_type1_attach_group() X-Git-Tag: v4.11-rc1~158^2^6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c9f1af528a4581e8ef8590108daa3c3df08dd5a;p=thirdparty%2Fkernel%2Flinux.git vfio/type1: Fix error return code in vfio_iommu_type1_attach_group() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 5d704992189f ("vfio/type1: Allow transparent MSI IOVA allocation") Signed-off-by: Wei Yongjun Reviewed-by: Eric Auger Acked-by: Alex Williamson Signed-off-by: Joerg Roedel --- diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 0f353f5195747..bd6f293c4ebd5 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1332,8 +1332,11 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, if (ret) goto out_detach; - if (resv_msi && iommu_get_msi_cookie(domain->domain, resv_msi_base)) - goto out_detach; + if (resv_msi) { + ret = iommu_get_msi_cookie(domain->domain, resv_msi_base); + if (ret) + goto out_detach; + } list_add(&domain->next, &iommu->domain_list);