RE: [PATCH v1 2/4] iommu: Unpublish the attach handle before the PASID detach callback

From: Tian, Kevin

Date: Thu Oct 29 2026 - 03:23:43 EST


> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Wednesday, September 30, 2026 5:52 AM
>
> iommu_detach_device_pasid() erases the group->pasid_array entry only once
> __iommu_remove_group_pasid() has returned, so the detaching handle stays
> visible to iommu_attach_handle_get() for the whole of that callback, and
> the caller frees it as soon as the detach returns.
>
> Erase the entry ahead of the callback, for the same reason the group path
> does: a fault raised in the meantime must not resolve to a domain that is
> on its way out.
>
> Fixes: 16603704559c ("iommu: Add attach/detach_dev_pasid iommu
> interfaces")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>