From: Matthew Auld <matthew.auld@intel.com>
To: "Tapani Pälli" <tapani.palli@intel.com>, intel-xe@lists.freedesktop.org
Cc: matthew.brost@intel.com
Subject: Re: [PATCH v2] drm/xe: Fix NULL pointer dereference in xe_exec_ioctl
Date: Wed, 17 Dec 2025 12:57:52 +0000 [thread overview]
Message-ID: <dc533a8b-ad80-446f-a3f7-1fdde195a0e2@intel.com> (raw)
In-Reply-To: <20251217123209.430427-1-tapani.palli@intel.com>
On 17/12/2025 12:32, Tapani Pälli wrote:
> Helper function xe_sync_needs_wait expects sync->fence when accessing
> flags, patch makes sure we call only when sync->fence exists.
>
> v2: move null checking to xe_sync_needs_wait and make
> xe_sync_entry_wait utilize this helper (Matthew Auld)
>
> 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_sync.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
> index ee1344a880b9..2b6c2e2527ae 100644
> --- a/drivers/gpu/drm/xe/xe_sync.c
> +++ b/drivers/gpu/drm/xe/xe_sync.c
> @@ -241,7 +241,8 @@ int xe_sync_entry_wait(struct xe_sync_entry *sync)
> if (sync->flags & DRM_XE_SYNC_FLAG_SIGNAL)
> return 0;
^^ I think we can drop this bit, since below will now check it?
>
> - return dma_fence_wait(sync->fence, true);
> + return xe_sync_needs_wait(sync) ?
> + dma_fence_wait(sync->fence, true) : 0;
> }
>
> /**
> @@ -252,7 +253,7 @@ int xe_sync_entry_wait(struct xe_sync_entry *sync)
> */
> bool xe_sync_needs_wait(struct xe_sync_entry *sync)
> {
> - return !(sync->flags & DRM_XE_SYNC_FLAG_SIGNAL) &&
> + return !(sync->flags & DRM_XE_SYNC_FLAG_SIGNAL) && sync->fence &&
> !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &sync->fence->flags);
Here I think we can maybe simplify:
sync->fence && !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &sync->fence->flags)
Since sync->fence != NULL must imply an in-fence which will always be
!signal for the flags anyway?
> }
>
next prev parent reply other threads:[~2025-12-17 12:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 6:17 [PATCH] drm/xe: Fix NULL pointer dereference in xe_exec_ioctl Tapani Pälli
2025-12-17 8:00 ` ✓ CI.KUnit: success for " 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 [this message]
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=dc533a8b-ad80-446f-a3f7-1fdde195a0e2@intel.com \
--to=matthew.auld@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=tapani.palli@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