]> git.baikalelectronics.ru Git - kernel.git/commit
iommu: Fix error unwind in iommu_group_alloc()
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 16 Feb 2023 01:21:16 +0000 (21:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:39 +0000 (09:33 +0100)
commit9526c12281d8b7758e29783cf01378144e8311a6
tree7082b79cad926251d5e37b94d41323a9f840f782
parent8ac64928a7ac6ce00e46e5f064956f2db33a2317
iommu: Fix error unwind in iommu_group_alloc()

[ Upstream commit 7f8c378b65f72a05ad93c0b4b272906bd615eb57 ]

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: d68165fbddea ("iommu: Implement reserved_regions iommu-group sysfs file")
Fixes: 24c5e0c81c2d ("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>
drivers/iommu/iommu.c