drm/amdgpu: fix leak when we don't use the vm_fence
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu: fix leak when we don't use the vm_fence
If we don't end up using the vm fence, we never initialize it so it never gets freed. Free it in that case.
v2: handle this in the job callbacks.
Fixes db36632ea51e ("drm/amdgpu: clean up and unify hw fence handling")
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +10 -0
@@ -295,6 +295,11 @@ static void amdgpu_job_free_cb(struct drm_sched_job *s_job)amdgpu_sync_free (&job->explicit_sync); +if (!job->hw_fence->base.ops) +kfree (job->hw_fence); +if (!job->hw_vm_fence->base.ops) +kfree (job->hw_vm_fence); +kfree (job); }
@@ -324,6 +329,11 @@ void amdgpu_job_free(struct amdgpu_job *job)if (job->gang_submit != &job->base.s_fence->scheduled)dma_fence_put (job->gang_submit); +if (!job->hw_fence->base.ops) +kfree (job->hw_fence); +if (!job->hw_vm_fence->base.ops) +kfree (job->hw_vm_fence); +kfree (job); }
Signature · 1 line
2.51.0
bad commit message ignore this one too.
Quoted 43 lines · Alex Deucher
If we don't end up using the vm fence, we never initialize it so it never gets freed. Free it in that case.
v2: handle this in the job callbacks.
Fixes db36632ea51e ("drm/amdgpu: clean up and unify hw fence handling")Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +10
-1@@ -295,6 +295,11 @@ static void amdgpu_job_free_cb(struct drm_sched_job *s_job)amdgpu_sync_free (&job->explicit_sync); +if (!job->hw_fence->base.ops) +kfree (job->hw_fence); +if (!job->hw_vm_fence->base.ops) +kfree (job->hw_vm_fence); +kfree (job); }@@ -324,6 +329,11 @@ void amdgpu_job_free(struct amdgpu_job *job)if (job->gang_submit != &job->base.s_fence->scheduled)dma_fence_put (job->gang_submit); +if (!job->hw_fence->base.ops) +kfree (job->hw_fence); +if (!job->hw_vm_fence->base.ops) +kfree (job->hw_vm_fence); +kfree (job); } --2.51.0