Patch "iommufd: Reject non-zero data_type if no data_len is provided" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iommufd: Reject non-zero data_type if no data_len is provided

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommufd-reject-non-zero-data_type-if-no-data_len-is-.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cbab42865ce5eb39aec175e4f101968c31a3c43d
Author: Jason Gunthorpe <jgg@xxxxxxxx>
Date:   Tue Feb 20 14:43:54 2024 -0400

    iommufd: Reject non-zero data_type if no data_len is provided
    
    [ Upstream commit 7adc0c1cfa7732b81bf7bf2ed16ffb99719ceebf ]
    
    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: bd529dbb661d ("iommufd: Add a nested HW pagetable object")
    Link: https://lore.kernel.org/r/0-v1-9b1ea6869554+110c60-iommufd_ck_data_type_jgg@xxxxxxxxxx
    Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index cbb5df0a6c32f..6f680959b23ed 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -261,7 +261,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);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux