Skip to content

Commit 5d319f7

Browse files
robclarkRob Clark
authored andcommitted
drm/msm: Fix a fence leak in submit error path
In error paths, we could unref the submit without calling drm_sched_entity_push_job(), so msm_job_free() will never get called. Since drm_sched_job_cleanup() will NULL out the s_fence, we can use that to detect this case. Signed-off-by: Rob Clark <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/653584/ Signed-off-by: Rob Clark <[email protected]>
1 parent 8a48e35 commit 5d319f7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/msm/msm_gem_submit.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ void __msm_gem_submit_destroy(struct kref *kref)
8585
container_of(kref, struct msm_gem_submit, ref);
8686
unsigned i;
8787

88+
/*
89+
* In error paths, we could unref the submit without calling
90+
* drm_sched_entity_push_job(), so msm_job_free() will never
91+
* get called. Since drm_sched_job_cleanup() will NULL out
92+
* s_fence, we can use that to detect this case.
93+
*/
94+
if (submit->base.s_fence)
95+
drm_sched_job_cleanup(&submit->base);
96+
8897
if (submit->fence_id) {
8998
spin_lock(&submit->queue->idr_lock);
9099
idr_remove(&submit->queue->fence_idr, submit->fence_id);

0 commit comments

Comments
 (0)