[PATCH v2 2/3] iommu/amd: Don't call report_iommu_fault()

Jason Gunthorpe jgg at nvidia.com
Thu Nov 20 11:35:06 PST 2025


On Tue, Nov 18, 2025 at 11:58:39PM +0000, Tian, Kevin wrote:
> > > > -
> > > > -			if (!report_iommu_fault(&dev_data->domain-
> > > > >domain,
> > > > -						&pdev->dev, address,
> > > > -						IS_WRITE_REQUEST(flags) ?
> > > > -
> > > > 	IOMMU_FAULT_WRITE :
> > > > -
> > > > 	IOMMU_FAULT_READ))
> > > > -				goto out;
> > > >  		}
> > > >
> > > >  		if (__ratelimit(&dev_data->rs)) {
> > >
> > > Remove amd_iommu_report_page_fault() too?
> > 
> > I don't understand this remark?
> > 
> > amd_iommu_report_page_fault() generates the dmesg logging on iommu
> > faults?
> 
> sorry I meant generating the dmesg logging same as other error
> types in iommu_print_event(). No need for a separate function.

Okay, that does make sense, but this driver is kinda broken because it
is using 

	pdev = pci_get_domain_bus_and_slot(iommu->pci_seg->id, PCI_BUS_NUM(devid),
					   devid & 0xff);
	if (pdev)
		dev_data = dev_iommu_priv_get(&pdev->dev);

Which is UAF racy on dev_data.

Fixing that is troublesome..

Really all the fault handling here needs some attention, all the
events that have BDFs should all print the same, using a pci print or
using raw BDFs. Translation fault shouldn't be special..

Too big for this series, so I'll leave it..

Thanks,
Jason





More information about the Linux-rockchip mailing list