Skip to content

Commit 82926f5

Browse files
mbrost05lucasdemarchi
authored andcommitted
drm/xe: Don't free job in TDR
Freeing job in TDR is not safe as TDR can pass the run_job thread resulting in UAF. It is only safe for free job to naturally be called by the scheduler. Rather free job in TDR, add to pending list. Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2811 Cc: Matthew Auld <[email protected]> Fixes: e275d61 ("drm/xe/guc: Handle timing out of signaled jobs gracefully") Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit ea2f6a7) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent ed931fb commit 82926f5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/gpu/drm/xe/xe_guc_submit.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,10 +1030,13 @@ guc_exec_queue_timedout_job(struct drm_sched_job *drm_job)
10301030

10311031
/*
10321032
* TDR has fired before free job worker. Common if exec queue
1033-
* immediately closed after last fence signaled.
1033+
* immediately closed after last fence signaled. Add back to pending
1034+
* list so job can be freed and kick scheduler ensuring free job is not
1035+
* lost.
10341036
*/
10351037
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &job->fence->flags)) {
1036-
guc_exec_queue_free_job(drm_job);
1038+
xe_sched_add_pending_job(sched, job);
1039+
xe_sched_submission_start(sched);
10371040

10381041
return DRM_GPU_SCHED_STAT_NOMINAL;
10391042
}

0 commit comments

Comments
 (0)