> From: Nicolin Chen <[email protected]>
> Sent: Saturday, June 14, 2025 3:15 PM
> 
> +int iommufd_access_notify_unmap(struct io_pagetable *iopt, unsigned long
> iova,
> +                             unsigned long length)
>  {
>       struct iommufd_ioas *ioas =
>               container_of(iopt, struct iommufd_ioas, iopt);
>       struct iommufd_access *access;
>       unsigned long index;
> +     int ret = 0;
> 
>       xa_lock(&ioas->iopt.access_list);
>       xa_for_each(&ioas->iopt.access_list, index, access) {
> +             if (!access->ops || !access->ops->unmap) {
> +                     ret = -EBUSY;
> +                     goto unlock;
> +             }

then accesses before this one have been notified to unpin the area
while accesses afterwards are left unnotified.

in the end the unmap fails but with some side-effect incurred.

I'm not sure whether this intermediate state may lead to any undesired
effect later. Just raise it in case you or Jason already thought about it.


>                       /* Something is not responding to unmap requests.
> */
>                       tries++;
> -                     if (WARN_ON(tries > 100))
> -                             return -EDEADLOCK;
> +                     if (WARN_ON(tries > 100)) {
> +                             rc = -EDEADLOCK;
> +                             goto out_unmapped;
> +                     }

this looks an unrelated fix?

Reply via email to