Patch "iommu: Fix error unwind in iommu_group_alloc()" has been added to the 6.1-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

    iommu: Fix error unwind in iommu_group_alloc()

to the 6.1-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:
     iommu-fix-error-unwind-in-iommu_group_alloc.patch
and it can be found in the queue-6.1 subdirectory.

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



commit dacf8cabf70d3bccb952040e54a1b939f5b6bd1c
Author: Jason Gunthorpe <jgg@xxxxxxxx>
Date:   Wed Feb 15 21:21:16 2023 -0400

    iommu: Fix error unwind in iommu_group_alloc()
    
    [ Upstream commit 4daa861174d56023c2068ddb03de0752f07fa199 ]
    
    If either iommu_group_grate_file() fails then the
    iommu_group is leaked.
    
    Destroy it on these error paths.
    
    Found by kselftest/iommu/iommufd_fail_nth
    
    Fixes: bc7d12b91bd3 ("iommu: Implement reserved_regions iommu-group sysfs file")
    Fixes: c52c72d3dee8 ("iommu: Add sysfs attribyte for domain type")
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/0-v1-8f616bee028d+8b-iommu_group_alloc_leak_jgg@xxxxxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 959d895fc1dff..fd8c8aeb3c504 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -749,12 +749,16 @@ struct iommu_group *iommu_group_alloc(void)
 
 	ret = iommu_group_create_file(group,
 				      &iommu_group_attr_reserved_regions);
-	if (ret)
+	if (ret) {
+		kobject_put(group->devices_kobj);
 		return ERR_PTR(ret);
+	}
 
 	ret = iommu_group_create_file(group, &iommu_group_attr_type);
-	if (ret)
+	if (ret) {
+		kobject_put(group->devices_kobj);
 		return ERR_PTR(ret);
+	}
 
 	pr_debug("Allocated group %d\n", group->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