]> Git Repo - J-linux.git/commitdiff
drm/xe: Free job before xe_exec_queue_put
authorMatthew Brost <[email protected]>
Tue, 20 Aug 2024 20:23:09 +0000 (13:23 -0700)
committerRodrigo Vivi <[email protected]>
Wed, 21 Aug 2024 15:53:15 +0000 (11:53 -0400)
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: dd08ebf6c352 ("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 32a42c93b74c8ca6d0915ea3eba21bceff53042f)
Signed-off-by: Rodrigo Vivi <[email protected]>
drivers/gpu/drm/xe/xe_sched_job.c

index 44d534e362cd39ebc338810c6f6a7318bd1cf75b..9628f9deb3c0122d4d0f1b76619243b7b38718d2 100644 (file)
@@ -171,12 +171,13 @@ void xe_sched_job_destroy(struct kref *ref)
        struct xe_sched_job *job =
                container_of(ref, struct xe_sched_job, refcount);
        struct xe_device *xe = job_to_xe(job);
+       struct xe_exec_queue *q = job->q;
 
        xe_sched_job_free_fences(job);
-       xe_exec_queue_put(job->q);
        dma_fence_put(job->fence);
        drm_sched_job_cleanup(&job->drm);
        job_free(job);
+       xe_exec_queue_put(q);
        xe_pm_runtime_put(xe);
 }
 
This page took 0.0505 seconds and 4 git commands to generate.