iommu/amd/iommu_v2: fix pci device refcount leak in ppr_notifier()
Subsystems (2)
PATCH 1/1 iommu/amd/iommu_v2: fix pci device refcount leak in ppr_notifier()
As comment of pci_get_domain_bus_and_slot() says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by calling pci_dev_put(). So call it before returning from ppr_notifier() to avoid refcount leak.
Fixes daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")
Signed-off-by Yang Yingliang <[email protected]>
--- drivers/iommu/amd/iommu_v2.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/amd/iommu_v2.c +1 -0
@@ -587,6 +587,7 @@ static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data)put_device_state (dev_state); out: +pci_dev_put (pdev);return ret; }
Signature · 1 line
2.25.1
Quoted 11 lines · Yang Yingliang
As comment of
pci_get_domain_bus_and_slot()says, it returns a pci device with refcount increment, when finish using it, the caller must decrement the reference count by callingpci_dev_put(). So call it before returning fromppr_notifier()to avoid refcount leak.Fixes daae2d25a477 ("iommu/amd: Don't copy GCR3 table root pointer")Signed-off-by Yang Yingliang <[email protected]>--- drivers/iommu/amd/iommu_v2.c | 1 + 1 file changed, 1 insertion(+)
Applied, thanks.