On Thu, Jul 27, 2023 at 11:33:26PM -0700, Nicolin Chen wrote:
Update the unprotect routine in iommufd_access_destroy_object() to calling the new iommufd_access_change_ioas() helper. This will reduce some risk of race condition with another concurrent iommufd_access_replace/detach call.
Note that the behavior of this function call is changed: a WARN_ON will be triggered by a -EBUSY return code if there is another ongoing detach.
This should be completely impossible, at this point the object must have a refcount of 0 so if another thread is concurrently detaching it we are already UAFing.
Reviewed-by: Jason Gunthorpe jgg@nvidia.com
Jason