]> www.infradead.org Git - users/hch/block.git/commitdiff
iommu: Fix a check in iommu_check_bind_data()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 3 Nov 2020 10:16:23 +0000 (13:16 +0300)
committerJoerg Roedel <jroedel@suse.de>
Tue, 3 Nov 2020 13:55:51 +0000 (14:55 +0100)
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201103101623.GA1127762@mwanda
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c

index 8c470f451a323e590293309c0331af3db10bebaf..b53446bb8c6b4e7970f494fe4dc52d76bb1e07cc 100644 (file)
@@ -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)