Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Tapani Pälli" <tapani.palli@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.brost@intel.com, "Tapani Pälli" <tapani.palli@intel.com>
Subject: [PATCH] drm/xe: Fix NULL pointer dereference in xe_exec_ioctl
Date: Wed, 17 Dec 2025 08:17:28 +0200	[thread overview]
Message-ID: <20251217061728.35768-1-tapani.palli@intel.com> (raw)

Helper function xe_sync_needs_wait expects sync->fence when accessing
flags, patch makes sure we call only when sync->fence exists.

Fixes NULL pointer dereference seen with Vulkan workloads:

[  118.410401] RIP: 0010:xe_sync_needs_wait+0x27/0x50 [xe]

Fixes: 4ac9048d0501 ("drm/xe: Wait on in-syncs when swicthing to dma-fence mode")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
---
 drivers/gpu/drm/xe/xe_exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index 730a5c9c2637..ea368f02cb9f 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -184,7 +184,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 		if (xe_sync_is_ufence(&syncs[num_syncs]))
 			num_ufence++;
 
-		if (!num_in_sync && xe_sync_needs_wait(&syncs[num_syncs]))
+		if (!num_in_sync && syncs[num_syncs].fence &&
+		    xe_sync_needs_wait(&syncs[num_syncs]))
 			num_in_sync++;
 	}
 
-- 
2.52.0


             reply	other threads:[~2025-12-17  6:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17  6:17 Tapani Pälli [this message]
2025-12-17  8:00 ` ✓ CI.KUnit: success for drm/xe: Fix NULL pointer dereference in xe_exec_ioctl Patchwork
2025-12-17  9:01 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-17 10:27 ` [PATCH] " Matthew Auld
2025-12-17 10:31   ` Matthew Auld
2025-12-17 10:51     ` Tapani Pälli
2025-12-17 11:42       ` Tapani Pälli
2025-12-17 11:51       ` Matthew Auld
2025-12-17 12:22         ` Tapani Pälli
2025-12-17 12:32           ` [PATCH v2] " Tapani Pälli
2025-12-17 12:57             ` Matthew Auld
2025-12-17 13:21               ` Tapani Pälli
2025-12-17 13:24                 ` [PATCH v3] " Tapani Pälli
2025-12-17 14:56                   ` Matthew Auld
2025-12-17 21:04                     ` Matthew Brost
2025-12-17 21:16           ` [PATCH] " Matthew Brost
2025-12-17 13:10 ` ✓ CI.KUnit: success for drm/xe: Fix NULL pointer dereference in xe_exec_ioctl (rev2) Patchwork
2025-12-17 13:48 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-17 15:43 ` ✓ CI.KUnit: success for drm/xe: Fix NULL pointer dereference in xe_exec_ioctl (rev3) Patchwork
2025-12-17 16:23 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-18 14:16 ` ✗ Xe.CI.Full: failure " Patchwork

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=20251217061728.35768-1-tapani.palli@intel.com \
    --to=tapani.palli@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