From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH] drm/xe: Free job before xe_exec_queue_put
Date: Tue, 20 Aug 2024 13:23:09 -0700 [thread overview]
Message-ID: <20240820202309.1260755-1-matthew.brost@intel.com> (raw)
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@intel.com>
---
drivers/gpu/drm/xe/xe_sched_job.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_sched_job.c b/drivers/gpu/drm/xe/xe_sched_job.c
index 44d534e362cd..9628f9deb3c0 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);
}
--
2.34.1
next reply other threads:[~2024-08-20 20:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 20:23 Matthew Brost [this message]
2024-08-20 20:27 ` [PATCH] drm/xe: Free job before xe_exec_queue_put Nirmoy Das
2024-08-20 20:36 ` ✓ CI.Patch_applied: success for " Patchwork
2024-08-20 20:36 ` ✓ CI.checkpatch: " Patchwork
2024-08-20 20:37 ` ✓ CI.KUnit: " Patchwork
2024-08-20 20:55 ` ✓ CI.Build: " Patchwork
2024-08-20 20:57 ` ✓ CI.Hooks: " Patchwork
2024-08-20 20:59 ` ✓ CI.checksparse: " Patchwork
2024-08-20 21:03 ` [PATCH] " Randhawa, Jagmeet
2024-08-20 21:35 ` ✓ CI.BAT: success for " Patchwork
2024-08-21 4:24 ` ✗ CI.FULL: failure " Patchwork
2024-08-21 6:22 ` [PATCH] " Ghimiray, Himal Prasad
2024-08-21 15:23 ` Matthew Brost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240820202309.1260755-1-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox