mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-25 15:24:17 +08:00
iommu: Fix error unwind in iommu_group_alloc()
[ Upstream commit4daa861174
] 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:bc7d12b91b
("iommu: Implement reserved_regions iommu-group sysfs file") Fixes:c52c72d3de
("iommu: Add sysfs attribyte for domain type") Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/0-v1-8f616bee028d+8b-iommu_group_alloc_leak_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
76e0396313
commit
f119ef452e
@ -656,12 +656,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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user