Skip to content

Commit 9e7f305

Browse files
mbrost05rodrigovivi
authored andcommitted
drm/xe: Free job before xe_exec_queue_put
Free job depends on job->vm being valid, the last xe_exec_queue_put can destroy the VM. Prevent UAF by freeing job before xe_exec_queue_put. Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> Reviewed-by: Jagmeet Randhawa <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 32a42c9) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent dd3e840 commit 9e7f305

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/xe/xe_sched_job.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,13 @@ void xe_sched_job_destroy(struct kref *ref)
171171
struct xe_sched_job *job =
172172
container_of(ref, struct xe_sched_job, refcount);
173173
struct xe_device *xe = job_to_xe(job);
174+
struct xe_exec_queue *q = job->q;
174175

175176
xe_sched_job_free_fences(job);
176-
xe_exec_queue_put(job->q);
177177
dma_fence_put(job->fence);
178178
drm_sched_job_cleanup(&job->drm);
179179
job_free(job);
180+
xe_exec_queue_put(q);
180181
xe_pm_runtime_put(xe);
181182
}
182183

0 commit comments

Comments
 (0)