Skip to content

Commit 816997d

Browse files
Jiang Liujoergroedel
authored andcommitted
iommu/vt-d: Avoid caching stale domain_device_info and fix memory leak
Function device_notifier() in intel-iommu.c fails to remove device_domain_info data structures for PCI devices if they are associated with si_domain because iommu_no_mapping() returns true for those PCI devices. This will cause memory leak and caching of stale information in domain->devices list. So fix the issue by not calling iommu_no_mapping() and skipping check of iommu_pass_through. Signed-off-by: Jiang Liu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 989d51f commit 816997d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3600,14 +3600,14 @@ static int device_notifier(struct notifier_block *nb,
36003600
struct pci_dev *pdev = to_pci_dev(dev);
36013601
struct dmar_domain *domain;
36023602

3603-
if (iommu_no_mapping(dev))
3603+
if (iommu_dummy(pdev))
36043604
return 0;
36053605

36063606
domain = find_domain(pdev);
36073607
if (!domain)
36083608
return 0;
36093609

3610-
if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) {
3610+
if (action == BUS_NOTIFY_UNBOUND_DRIVER) {
36113611
domain_remove_one_dev_info(domain, pdev);
36123612

36133613
if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&

0 commit comments

Comments
 (0)