Commit 5d319f75 authored by Rob Clark's avatar Rob Clark
Browse files

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: default avatarRob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/653584/


Signed-off-by: default avatarRob Clark <robin.clark@oss.qualcomm.com>
parent 8a48e35b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -85,6 +85,15 @@ void __msm_gem_submit_destroy(struct kref *kref)
			container_of(kref, struct msm_gem_submit, ref);
	unsigned i;

	/*
	 * 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
	 * s_fence, we can use that to detect this case.
	 */
	if (submit->base.s_fence)
		drm_sched_job_cleanup(&submit->base);

	if (submit->fence_id) {
		spin_lock(&submit->queue->idr_lock);
		idr_remove(&submit->queue->fence_idr, submit->fence_id);