Skip to contentSkip to conversation

vfio/type1: fix error return code in vfio_iommu_type1_attach_group()

PATCH Applied Wei Yongjun 5 participants 5 messages Feb 9, 2017 – Feb 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio/type1: fix error return code in vfio_iommu_type1_attach_group()

From: Wei Yongjun <[email protected]>

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")
---
 drivers/vfio/vfio_iommu_type1.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/vfio/vfio_iommu_type1.c +5 -2
index 0f353f5..bd6f293 100644
@@ -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);
Reviewed-by on v1 1/1
#1 lore raw

Hi Wei,

Quoted 7 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

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")

Thanks for spotting this.

Eric

Quoted 22 lines
---
 drivers/vfio/vfio_iommu_type1.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/vfio/vfio_iommu_type1.c +5 -2
index 0f353f5..bd6f293 100644
@@ -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);
 
#2 lore raw
Quoted 5 lines · On Thu, 9 Feb 2017 18:03:47 +0100 Auger Eric <[email protected]> wrote:

Hi Wei,

Quoted 2 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

Quoted 7 lines
Quoted 5 lines

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")

Joerg/Will,

The original commit comes in through iommu/next (arm/core), please feel free to also include this fix. Thanks,

Alex

Quoted 22 lines
Quoted 22 lines
---
 drivers/vfio/vfio_iommu_type1.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/vfio/vfio_iommu_type1.c +5 -2
index 0f353f5..bd6f293 100644
@@ -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);
 
#3 lore raw
Quoted 11 lines · Alex Williamson
Quoted 9 lines · On Thu, 9 Feb 2017 18:03:47 +0100 Auger Eric <[email protected]> wrote:
Quoted 7 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

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")
Quoted 8 lines
Quoted 1 line

Joerg/Will,

The original commit comes in through iommu/next (arm/core), please feel free to also include this fix. Thanks,

Patch looks fine to me. Joerg, can you pick this up please?

Will

Applied
#4 lore raw
Quoted 1 line · Will Deacon

Patch looks fine to me. Joerg, can you pick this up please?

Picked up, thanks.