All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: FNU VISHWANATHA <fnu.vishwanatha@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Kornel Dulęba" <korneld@google.com>
Subject: Re: [PATCH 2/2] RFC: drm/xe: Prevent pinned_link double add
Date: Thu, 15 Oct 2026 06:53:33 -0700	[thread overview]
Message-ID: <atDa3ZTjuaZcjlwG@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20261006175741.3582911-2-fnu.vishwanatha@intel.com>

On Tue, Oct 06, 2026 at 10:57:41AM -0700, FNU VISHWANATHA wrote:
> From: Kornel Dulęba <korneld@google.com>
> 
> When running CtsCameraTestCases on a memory constrained, 4GB device the
> following list corruption oops was consistently observed:
> 
> list_del corruption. prev->next should be ffff9ebe1ce42ea8, but was ffff9ebdf741fea8. (prev=ffff9ebe1ce43aa8)
> 
> After adding printfs in multiple places it was concluded that
> bo->pinned_link was already a part of a list when xe_bo_pin_external
> tried adding it to xe->pinned.late.external.
> To fix this add a list_empty check and a WARN_ONCE in case the list is
> in fact not empty.
> With this addition the CtsCameraTestCases can now complete with no
> kernel crashes.
> 
> Test: atest CtsCameraTestCases
> Signed-off-by: Kornel Dulęba <korneld@google.com>
> ---
>  drivers/gpu/drm/xe/xe_bo.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index c5989db950f7..cc5a4ff64791 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -2762,7 +2762,14 @@ int xe_bo_pin_external(struct xe_bo *bo, bool in_place, struct drm_exec *exec)
>  		}
>  
>  		spin_lock(&xe->pinned.lock);
> -		list_add_tail(&bo->pinned_link, &xe->pinned.late.external);

Like in first patch - I'd rather have a 'xe_assert(xe,
list_empty(&bo->pinned_link)' here as any other state is a bug.

Again if it pops, we then case down why this occuring rather than
papering over.

Again file gitlab with details so we can assist.

Matt

> +		if (list_empty(&bo->pinned_link)) {
> +			list_add_tail(&bo->pinned_link,
> +				      &xe->pinned.late.external);
> +		} else {
> +			WARN_ONCE(true,
> +				  "pinned_link already added to a list, bo->ttm.pin_count: %d\n",
> +				  bo->ttm.pin_count);
> +		}
>  		spin_unlock(&xe->pinned.lock);
>  	}
>  
> -- 
> 2.34.1
> 

  parent reply	other threads:[~2026-10-15 13:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 17:57 [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic FNU VISHWANATHA
2026-10-06 17:57 ` [PATCH 2/2] RFC: drm/xe: Prevent pinned_link double add FNU VISHWANATHA
2026-10-06 18:16   ` sashiko-bot
2026-10-15 13:53   ` Matthew Brost [this message]
2026-10-06 18:15 ` [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic sashiko-bot
2026-10-06 18:37 ` ✗ CI.checkpatch: warning for series starting with [1/2] " Patchwork
2026-10-06 18:39 ` ✓ CI.KUnit: success " Patchwork
2026-10-06 19:38 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-07  1:17 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-13 22:06 ` ✗ CI.checkpatch: warning for series starting with [1/2] RFC: drm/xe: Fix pinned list UAF panic (rev2) Patchwork
2026-10-13 22:08 ` ✓ CI.KUnit: success " Patchwork
2026-10-14  3:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-14 14:50 ` ✓ Xe.CI.FULL: " Patchwork
2026-10-15 13:51 ` [PATCH 1/2] RFC: drm/xe: Fix pinned list UAF panic Matthew Brost
2026-10-15 13:54   ` 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=atDa3ZTjuaZcjlwG@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fnu.vishwanatha@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=korneld@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.