From: Yang Yingliang Date: Fri, 18 Nov 2022 09:36:04 +0000 (+0800) Subject: iommu/amd: Fix pci device refcount leak in ppr_notifier() X-Git-Tag: v6.6.17~5882^2^10~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cf0981c2233f97d56938d9d61845383d6eb227c;p=platform%2Fkernel%2Flinux-rpi.git iommu/amd: 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 Link: https://lore.kernel.org/r/20221118093604.216371-1-yangyingliang@huawei.com Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c index 6a1f02c..9f7fab4 100644 --- a/drivers/iommu/amd/iommu_v2.c +++ b/drivers/iommu/amd/iommu_v2.c @@ -587,6 +587,7 @@ out_drop_state: put_device_state(dev_state); out: + pci_dev_put(pdev); return ret; }