linux-stable/drivers/iommu/intel
Xiongfeng Wang 2a8f7b9068 iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init()
[ Upstream commit 4bedbbd782 ]

for_each_pci_dev() is implemented by pci_get_device(). The comment of
pci_get_device() says that it will increase the reference count for the
returned pci_dev and also decrease the reference count for the input
pci_dev @from if it is not NULL.

If we break for_each_pci_dev() loop with pdev not NULL, we need to call
pci_dev_put() to decrease the reference count. Add the missing
pci_dev_put() for the error path to avoid reference count leak.

Fixes: 2e45528930 ("iommu/vt-d: Unify the way to process DMAR device scope array")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Link: https://lore.kernel.org/r/20221121113649.190393-3-wangxiongfeng2@huawei.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-08 11:30:21 +01:00
..
cap_audit.c iommu/vt-d: Move include/linux/intel-iommu.h under iommu 2022-07-15 10:21:31 +02:00
cap_audit.h
debugfs.c iommu/vt-d: Replace spin_lock_irqsave() with spin_lock() 2022-07-15 10:21:36 +02:00
dmar.c iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init() 2022-12-08 11:30:21 +01:00
iommu.c iommu/vt-d: Fix PCI device refcount leak in has_external_pci() 2022-12-08 11:30:21 +01:00
iommu.h iommu/vt-d: Fix kdump kernels boot failure with scalable mode 2022-09-07 15:14:55 +02:00
irq_remapping.c iommu/vt-d: Move include/linux/intel-iommu.h under iommu 2022-07-15 10:21:31 +02:00
Kconfig iommu/sva: Rename CONFIG_IOMMU_SVA_LIB to CONFIG_IOMMU_SVA 2022-02-14 19:17:46 +01:00
Makefile
pasid.c iommu/vt-d: Set SRE bit only when hardware has SRS cap 2022-11-26 09:27:50 +01:00
pasid.h iommu/vt-d: Remove clearing translation data in disable_dmar_iommu() 2022-07-15 10:21:34 +02:00
perf.c iommu/vt-d: Move include/linux/intel-iommu.h under iommu 2022-07-15 10:21:31 +02:00
perf.h
svm.c iommu/vt-d: Refactor iommu information of each domain 2022-07-15 10:21:41 +02:00
trace.c iommu/vt-d: Move trace/events/intel_iommu.h under iommu 2022-07-15 10:21:28 +02:00
trace.h iommu/vt-d: Move include/linux/intel-iommu.h under iommu 2022-07-15 10:21:31 +02:00