Skip to content

Commit 5e2d1d4

Browse files
mbrost05rodrigovivi
authored andcommitted
drm/xe: Fix possible UAF in guc_exec_queue_process_msg
Store xe_device ahead of processing message as message can be free'd in some cases. v2: - Including missing local changes v3: - Resend for CI Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202407231445.rpisd1vA-lkp@intel.com/ Fixes: 55ea73a ("drm/xe: Build PM into GuC CT layer") Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240724164341.1848954-1-matthew.brost@intel.com (cherry picked from commit 1a394b4) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 572239f commit 5e2d1d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/xe/xe_guc_submit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,8 @@ static void __guc_exec_queue_process_msg_resume(struct xe_sched_msg *msg)
13751375

13761376
static void guc_exec_queue_process_msg(struct xe_sched_msg *msg)
13771377
{
1378+
struct xe_device *xe = guc_to_xe(exec_queue_to_guc(msg->private_data));
1379+
13781380
trace_xe_sched_msg_recv(msg);
13791381

13801382
switch (msg->opcode) {
@@ -1394,7 +1396,7 @@ static void guc_exec_queue_process_msg(struct xe_sched_msg *msg)
13941396
XE_WARN_ON("Unknown message type");
13951397
}
13961398

1397-
xe_pm_runtime_put(guc_to_xe(exec_queue_to_guc(msg->private_data)));
1399+
xe_pm_runtime_put(xe);
13981400
}
13991401

14001402
static const struct drm_sched_backend_ops drm_sched_ops = {

0 commit comments

Comments
 (0)