On Thu, Nov 05, 2026 at 02:27:08PM -0500, Yuho Choi wrote: > > hv_iommu_paging_domain_free() frees all page-table pages with > > pt_iommu_deinit() and only then asks the hypervisor to delete the > > device domain that points at them. If HVCALL_DELETE_DEVICE_DOMAIN > > fails, hv_delete_device_domain() only logs the error, returns the > > domain ID to the IDA, and the domain is freed anyway. > > Isn't there a WARN_ON on this path? I recall asking for one ..
There isn't one yet. hv_delete_device_domain() only prints the error with hv_status_err(). The driver does WARN when a flush fails or when attaching to the blocking domain fails, but not when a delete fails. I'll add a WARN for the delete failure in v2. > Reviewed-by: Jason Gunthorpe <[email protected]> Thanks for the review! > Looks good but I think it is incomplete. > > if both hv_configure_device_domain and hv_delete_device_domain both > fails in hv_create_configure_device_domain, then unwind code will do > pt_iommu_deinit thus have the same UAF problem. You're right, thanks for catching this. If the delete also fails there, hv_iommu_domain_alloc_paging() still frees the page tables. In v2, I'll make hv_iommu_domain_alloc_paging() call hv_create_device_domain() and hv_configure_device_domain() itself, so it can leak the page tables and the domain when the delete fails, the same way hv_iommu_paging_domain_free() does.
