[PATCH v6 06/25] iommufd/access: Allow access->ops to be NULL for internal use

Tian, Kevin kevin.tian at intel.com
Tue Jun 24 20:38:19 PDT 2025


> From: Nicolin Chen <nicolinc at nvidia.com>
> 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?



More information about the linux-arm-kernel mailing list