> From: Liu, Yi L <yi.l.liu@xxxxxxxxx> > Sent: Thursday, September 12, 2024 9:13 PM > > @@ -191,13 +187,25 @@ int iommufd_fault_domain_replace_dev(struct > iommufd_device *idev, > return ret; > } > > - ret = __fault_domain_replace_dev(idev, hwpt, old); > + if (hwpt->fault) { > + curr = __fault_domain_replace_dev(idev, hwpt, old); > + ret = IS_ERR(curr) ? PTR_ERR(curr) : 0; > + } else { > + ret = iommu_replace_group_handle(idev->igroup->group, > + hwpt->domain, NULL); > + } > + > if (ret) { > if (iopf_on) > iommufd_fault_iopf_disable(idev); > return ret; > } > > + if (curr) { > + iommufd_auto_response_faults(old, curr); > + kfree(curr); > + } > + this is incorrect. The old code does auto response as long as old->fault is true and replace succeeds. But now you make it an operation only when hwpt->fault is true.