[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d516a6500ea0760e13cc19e2b14e663aa333518.1715048443.git.llfl@linux.alibaba.com>
Date: Tue, 7 May 2024 10:32:15 +0800
From: "Kun(llfl)" <llfl@...ux.alibaba.com>
To: Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>,
Jerry Snitselaar <jsnitsel@...hat.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
Robin Murphy <robin.murphy@....com>,
iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] 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: ad8694bac410 ("iommu/amd: Move AMD IOMMU driver into subdirectory")
Signed-off-by: Kun(llfl) <llfl@...ux.alibaba.com>
---
drivers/iommu/amd/init.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index ac6754a85f35..624ea2549f64 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -1678,8 +1678,15 @@ static void __init free_pci_segments(void)
}
}
+static void __init free_sysfs(struct amd_iommu *iommu)
+{
+ if (iommu->iommu.dev)
+ iommu_device_sysfs_remove(&iommu->iommu);
+}
+
static void __init free_iommu_one(struct amd_iommu *iommu)
{
+ free_sysfs(iommu);
free_cwwb_sem(iommu);
free_command_buffer(iommu);
free_event_buffer(iommu);
--
2.43.0
Powered by blists - more mailing lists