Skip to content

Commit a295ec5

Browse files
Kun(llfl)joergroedel
authored andcommitted
iommu/amd: Fix sysfs leak in iommu init
During the iommu initialization, iommu_init_pci() adds sysfs nodes. However, these nodes aren't remove in free_iommu_resources() subsequently. Fixes: 39ab955 ("iommu: Add sysfs bindings for struct iommu_device") Signed-off-by: Kun(llfl) <[email protected]> Reviewed-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/c8e0d11c6ab1ee48299c288009cf9c5dae07b42d.1715215003.git.llfl@linux.alibaba.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent c3f38fa commit a295ec5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/iommu/amd/init.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,8 +1626,17 @@ static void __init free_pci_segments(void)
16261626
}
16271627
}
16281628

1629+
static void __init free_sysfs(struct amd_iommu *iommu)
1630+
{
1631+
if (iommu->iommu.dev) {
1632+
iommu_device_unregister(&iommu->iommu);
1633+
iommu_device_sysfs_remove(&iommu->iommu);
1634+
}
1635+
}
1636+
16291637
static void __init free_iommu_one(struct amd_iommu *iommu)
16301638
{
1639+
free_sysfs(iommu);
16311640
free_cwwb_sem(iommu);
16321641
free_command_buffer(iommu);
16331642
free_event_buffer(iommu);

0 commit comments

Comments
 (0)