Skip to contentSkip to conversation

iommu: fix a check in iommu_check_bind_data()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 3, 2020

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

PATCH 1/1 iommu: fix a check in iommu_check_bind_data()

The "data->flags" variable is a u64 so if one of the high 32 bits is set the original code will allow it, but it should be rejected. The fix is to declare "mask" as a u64 instead of a u32.

Fixes d90573812eea ("iommu/uapi: Handle data and argsz filled by users")
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/iommu.c +1 -1
index 8c470f451a32..b53446bb8c6b 100644
@@ -2071,7 +2071,7 @@ EXPORT_SYMBOL_GPL(iommu_uapi_cache_invalidate);
 
 static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data)
 {
-	u32 mask;
+	u64 mask;
 	int i;
 
 	if (data->version != IOMMU_GPASID_BIND_VERSION_1)
Signature · 1 line
2.28.0
maintainer
#1 lore raw
Quoted 9 lines · Dan Carpenter

The "data->flags" variable is a u64 so if one of the high 32 bits is set the original code will allow it, but it should be rejected. The fix is to declare "mask" as a u64 instead of a u32.

Fixes d90573812eea ("iommu/uapi: Handle data and argsz filled by users")
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied for v5.10, thanks.