Re: [PATCH] iommu/amd: Put PCI device after handling PPR faults

Vasant Hegde <[email protected]> Mon, 27 Jul 2026 11:24:47 +0530
Newsgroups dev.linux.lists.iommu,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 7/27/2026 8:32 AM, Shuai Xue wrote:
> iommu_call_iopf_notifier() looks up the requester with
> pci_get_domain_bus_and_slot(), which returns a PCI device with its
> reference count incremented.
> 
> Neither the successful iommu_report_device_fault() path nor the abort
> path drops that reference, so every handled PPR request leaks a PCI
> device reference.
> 
> This is the same ownership rule that was fixed for the old iommu_v2
> ppr_notifier() path by commit 6cf0981c2233 ("iommu/amd: Fix pci device
> refcount leak in ppr_notifier()"), but iommu_call_iopf_notifier() was
> added later as a separate PPR/IOPF notifier path.
> 
> Drop the PCI device reference after handling the PPR entry.
> 
> Fixes: 978d626b8f1a ("iommu/amd: Add IO page fault notifier handler")
> Cc: [email protected]
> Assisted-by: Qoder:Qwen-3.8-MAX-Preview
> Signed-off-by: Shuai Xue <[email protected]>

Reviewed-by: Vasant Hegde <[email protected]>

-Vasant