Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Fix lifetime of struct amdgpu_task_info after ring reset

When a ring reset happens, amdgpu calls drm_dev_wedged_event() using
struct amdgpu_task_info *ti as one of the arguments. After using *ti, a
call to amdgpu_vm_put_task_info(ti) is required to correctly track its
lifetime.

However, it's called from a place that the ring reset path never reaches
due to a goto after drm_dev_wedged_event() is called. Move
amdgpu_vm_put_task_info() bellow the exit label to make sure that it's
called regardless of the code path.

amdgpu_vm_put_task_info() can only accept a valid address or NULL as
argument, so initialise *ti to make sure we can call this function if
*ti isn't used.

Fixes: a72002cb181f ("drm/amdgpu: Make use of drm_wedge_task_info")
Reported-by: Dave Airlie <airlied@gmail.com>
Closes: https://lore.kernel.org/dri-devel/CAPM=9tz0rQP8VZWKWyuF8kUMqRScxqoa6aVdwWw9=5yYxyYQ2Q@mail.gmail.com/
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20250704030629.1064397-1-andrealmeid@igalia.com
Signed-off-by: André Almeida <andrealmeid@igalia.com>

+2 -3
+2 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
··· 90 90 struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched); 91 91 struct amdgpu_job *job = to_amdgpu_job(s_job); 92 92 struct drm_wedge_task_info *info = NULL; 93 - struct amdgpu_task_info *ti; 93 + struct amdgpu_task_info *ti = NULL; 94 94 struct amdgpu_device *adev = ring->adev; 95 95 int idx, r; 96 96 ··· 148 148 149 149 dma_fence_set_error(&s_job->s_fence->finished, -ETIME); 150 150 151 - amdgpu_vm_put_task_info(ti); 152 - 153 151 if (amdgpu_device_should_recover_gpu(ring->adev)) { 154 152 struct amdgpu_reset_context reset_context; 155 153 memset(&reset_context, 0, sizeof(reset_context)); ··· 173 175 } 174 176 175 177 exit: 178 + amdgpu_vm_put_task_info(ti); 176 179 drm_dev_exit(idx); 177 180 return DRM_GPU_SCHED_STAT_NOMINAL; 178 181 }