Skip to content

Commit 8e96b36

Browse files
Jiqian Chenalexdeucher
authored andcommitted
drm/amdgpu: free hw_vm_fence when fail in amdgpu_job_alloc
If drm_sched_job_init fails, hw_vm_fence is not freed currently, then cause memory leak. Fixes: db36632 ("drm/amdgpu: clean up and unify hw fence handling") Link: https://lore.kernel.org/amd-gfx/a5a828cb-0e4a-41f0-94c3-df31e5ddad52@amd.com/T/#t Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com> Reviewed-by: Amos Kong <kongjianjun@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 5d42ee4)
1 parent 1034325 commit 8e96b36

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,11 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, struct amdgpu_vm *vm,
217217
if (!entity)
218218
return 0;
219219

220-
return drm_sched_job_init(&(*job)->base, entity, 1, owner,
221-
drm_client_id);
220+
r = drm_sched_job_init(&(*job)->base, entity, 1, owner, drm_client_id);
221+
if (!r)
222+
return 0;
223+
224+
kfree((*job)->hw_vm_fence);
222225

223226
err_fence:
224227
kfree((*job)->hw_fence);

0 commit comments

Comments
 (0)