WSL2-Linux-Kernel/drivers/iommu/intel
Xiongfeng Wang bdb613ef17 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:28:44 +01:00
..
Kconfig iommu/vt-d: Enable Intel IOMMU scalable mode by default 2021-08-19 10:41:08 +02:00
Makefile iommu/vt-d: Add common code for dmar latency performance monitors 2021-06-10 09:06:13 +02:00
cap_audit.c
cap_audit.h
debugfs.c iommu/vt-d: Expose latency monitor data through debugfs 2021-06-10 09:06:13 +02:00
dmar.c iommu/vt-d: Fix PCI device refcount leak in dmar_dev_scope_init() 2022-12-08 11:28:44 +01:00
iommu.c iommu/vt-d: Fix PCI device refcount leak in has_external_pci() 2022-12-08 11:28:44 +01:00
irq_remapping.c iommu/vt-d: Fix potential memory leak in intel_setup_irq_remapping() 2022-02-08 18:34:07 +01:00
pasid.c iommu/vt-d: Set SRE bit only when hardware has SRS cap 2022-11-26 09:24:47 +01:00
pasid.h Merge branches 'apple/dart', 'arm/smmu', 'iommu/fixes', 'x86/amd', 'x86/vt-d' and 'core' into next 2021-08-20 17:14:35 +02:00
perf.c iommu/vt-d: Drop the kernel doc annotation 2021-08-19 10:41:08 +02:00
perf.h iommu/vt-d: Add common code for dmar latency performance monitors 2021-06-10 09:06:13 +02:00
svm.c iommu/vt-d: Drop stop marker messages 2022-05-12 12:30:12 +02:00
trace.c