On Fri Oct 2, 2026 at 12:06 AM CEST, Matthew Brost wrote:
> @@ -1187,6 +1187,27 @@ bind_validate_region(struct nouveau_job *job)
>       return 0;
>  }
>  
> +/*
> + * Lock the VM's common dma-resv together with the one of @obj, as needed to
> + * drop what may be the last reference of a &drm_gpuvm_bo.
> + */
> +static void
> +nouveau_uvmm_lock_vm_and_obj(struct nouveau_uvmm *uvmm, struct drm_exec 
> *exec,
> +                          struct drm_gem_object *obj)
> +{
> +     int ret;
> +
> +     drm_exec_init(exec, DRM_EXEC_IGNORE_DUPLICATES, 2);
> +     drm_exec_until_all_locked(exec) {
> +             ret = drm_exec_lock_obj(exec, drm_gpuvm_resv_obj(&uvmm->base));
> +             if (!ret)
> +                     ret = drm_exec_lock_obj(exec, obj);

What happens if we reach this with ENOMEM? In such a case we may return without
any locks being held and nouveau would just continue calling into function that
expect locks to be held and hence produced UB, right?

(I think there is a similar case in MSM, but it was pre-existing, so I picked 
all
other patches.)

> +             drm_exec_retry_on_contention(exec);
> +             if (drm_WARN_ON(uvmm->base.drm, ret))
> +                     break;
> +     }
> +}

Reply via email to