mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-27 03:55:37 +08:00
iommufd: Reject non-zero data_type if no data_len is provided
Since the current design doesn't forward the data_type to the driver to
check unless there is a data_len/uptr for a driver specific struct we
should check and ensure that data_type is 0 if data_len is 0. Otherwise
any value is permitted.
Fixes: bd529dbb66
("iommufd: Add a nested HW pagetable object")
Link: https://lore.kernel.org/r/0-v1-9b1ea6869554+110c60-iommufd_ck_data_type_jgg@nvidia.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
4bbcbc6ea2
commit
7adc0c1cfa
@ -263,7 +263,8 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
|
||||
|
||||
if (cmd->__reserved)
|
||||
return -EOPNOTSUPP;
|
||||
if (cmd->data_type == IOMMU_HWPT_DATA_NONE && cmd->data_len)
|
||||
if ((cmd->data_type == IOMMU_HWPT_DATA_NONE && cmd->data_len) ||
|
||||
(cmd->data_type != IOMMU_HWPT_DATA_NONE && !cmd->data_len))
|
||||
return -EINVAL;
|
||||
|
||||
idev = iommufd_get_device(ucmd, cmd->dev_id);
|
||||
|
Loading…
Reference in New Issue
Block a user