Patch "drm/xe: Free job before xe_exec_queue_put" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/xe: Free job before xe_exec_queue_put

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-xe-free-job-before-xe_exec_queue_put.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3af646198a591741c8ac519ec6c8f16acf3e4a51
Author: Matthew Brost <matthew.brost@xxxxxxxxx>
Date:   Tue Aug 20 13:23:09 2024 -0700

    drm/xe: Free job before xe_exec_queue_put
    
    [ Upstream commit 9e7f30563677fbeff62d368d5d2a5ac7aaa9746a ]
    
    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 <matthew.brost@xxxxxxxxx>
    Reviewed-by: Nirmoy Das <nirmoy.das@xxxxxxxxx>
    Reviewed-by: Jagmeet Randhawa <jagmeet.randhawa@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240820202309.1260755-1-matthew.brost@xxxxxxxxx
    (cherry picked from commit 32a42c93b74c8ca6d0915ea3eba21bceff53042f)
    Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/xe/xe_sched_job.c b/drivers/gpu/drm/xe/xe_sched_job.c
index 29f3201d7dfac..2b064680abb96 100644
--- a/drivers/gpu/drm/xe/xe_sched_job.c
+++ b/drivers/gpu/drm/xe/xe_sched_job.c
@@ -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);
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux