From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Free job before xe_exec_queue_put
Date: Tue, 20 Aug 2024 22:27:13 +0200 [thread overview]
Message-ID: <ee8f18fa-1faf-46f2-be46-492f76dcc7a9@linux.intel.com> (raw)
In-Reply-To: <20240820202309.1260755-1-matthew.brost@intel.com>
On 8/20/2024 10:23 PM, Matthew Brost wrote:
> 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>
Reviewed-by: Nirmoy Das <nirmoy.das@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);
> }
>
next prev parent reply other threads:[~2024-08-20 20:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 20:23 [PATCH] drm/xe: Free job before xe_exec_queue_put Matthew Brost
2024-08-20 20:27 ` Nirmoy Das [this message]
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=ee8f18fa-1faf-46f2-be46-492f76dcc7a9@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
/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