Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
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] drm/xe: Fix NULL pointer dereference in xe_exec_ioctl
Date: Wed, 17 Dec 2025 10:27:05 +0000	[thread overview]
Message-ID: <773d97c4-defc-422c-a3a9-c7769f367493@intel.com> (raw)
In-Reply-To: <20251217061728.35768-1-tapani.palli@intel.com>

On 17/12/2025 06:17, 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.
> 
> 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]))

In xe_sync_entry_parse() it looks like it will always populate the fence 
for the !signal case, otherwise throwing an error if that is not 
possible. And xe_sync_needs_wait() will only touch the fence if it's the 
signal case? So it seems like this should not be possible?

>   			num_in_sync++;
>   	}
>   


  parent reply	other threads:[~2025-12-17 10:27 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 ` Matthew Auld [this message]
2025-12-17 10:31   ` [PATCH] " 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=773d97c4-defc-422c-a3a9-c7769f367493@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