From: Christian König Date: Thu, 12 Dec 2024 15:43:45 +0000 (+0100) Subject: drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare X-Git-Tag: block-6.14-20240131~40^2~14^2~9 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=26c95e838e63;p=linux-block.git drm/amdgpu: set the VM pointer to NULL in amdgpu_job_prepare As soon as the prepare phase is completed the VM might be released, better set it to NULL. Signed-off-by: Christian König Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 2e7e1c7dfe7c..04691753cabf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -361,6 +361,13 @@ amdgpu_job_prepare_job(struct drm_sched_job *sched_job, dev_err(ring->adev->dev, "Error getting VM ID (%d)\n", r); goto error; } + /* + * The VM structure might be released after the VMID is + * assigned, we had multiple problems with people trying to use + * the VM pointer so better set it to NULL. + */ + if (!fence) + job->vm = NULL; } return fence;