intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Brian Welty" <brian.welty@intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	stable@vger.kernel.org, "Matthew Brost" <matthew.brost@intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Jani Nikula" <jani.nikula@intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Matthew Auld" <matthew.auld@intel.com>
Subject: [PATCH v2 03/16] drm/xe/vm: Clear the scratch_pt pointer on error
Date: Fri, 22 Aug 2025 11:40:17 +0200	[thread overview]
Message-ID: <20250822094030.3499-4-thomas.hellstrom@linux.intel.com> (raw)
In-Reply-To: <20250822094030.3499-1-thomas.hellstrom@linux.intel.com>

Avoid triggering a dereference of an error pointer on cleanup in
xe_vm_free_scratch() by clearing any scratch_pt error pointer.

Fixes: 06951c2ee72d ("drm/xe: Use NULL PTEs as scratch PTEs")
Cc: Brian Welty <brian.welty@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_vm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index f35d69c0b4c6..529b6767caac 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -1635,8 +1635,12 @@ static int xe_vm_create_scratch(struct xe_device *xe, struct xe_tile *tile,
 
 	for (i = MAX_HUGEPTE_LEVEL; i < vm->pt_root[id]->level; i++) {
 		vm->scratch_pt[id][i] = xe_pt_create(vm, tile, i);
-		if (IS_ERR(vm->scratch_pt[id][i]))
-			return PTR_ERR(vm->scratch_pt[id][i]);
+		if (IS_ERR(vm->scratch_pt[id][i])) {
+			int err = PTR_ERR(vm->scratch_pt[id][i]);
+
+			vm->scratch_pt[id][i] = NULL;
+			return err;
+		}
 
 		xe_pt_populate_empty(tile, vm, vm->scratch_pt[id][i]);
 	}
-- 
2.50.1


  parent reply	other threads:[~2025-08-22  9:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22  9:40 [PATCH v2 00/16] Driver-managed exhaustive eviction Thomas Hellström
2025-08-22  9:40 ` [PATCH v2 01/16] drm/xe/vm: Don't pin the vm_resv during validation Thomas Hellström
2025-08-22  9:40 ` [PATCH v2 02/16] drm/xe/tests/xe_dma_buf: Set the drm_object::dma_buf member Thomas Hellström
2025-08-22  9:40 ` Thomas Hellström [this message]
2025-08-22  9:40 ` [PATCH v2 04/16] drm/xe: Pass down drm_exec context to validation Thomas Hellström
2025-08-22 19:59   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 05/16] drm/xe: Introduce an xe_validation wrapper around drm_exec Thomas Hellström
2025-08-26 20:42   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 06/16] drm/xe: Convert xe_bo_create_user() for exhaustive eviction Thomas Hellström
2025-08-23  9:32   ` Simon Richter
2025-08-22  9:40 ` [PATCH v2 07/16] drm/xe: Convert SVM validation " Thomas Hellström
2025-08-22 19:13   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 08/16] drm/xe: Convert existing drm_exec transactions " Thomas Hellström
2025-08-22  9:40 ` [PATCH v2 09/16] drm/xe: Convert the CPU fault handler " Thomas Hellström
2025-08-26 22:53   ` Matthew Brost
2025-08-27 14:16     ` Thomas Hellström
2025-08-27 15:52       ` Matthew Brost
2025-08-28  6:18         ` Thomas Hellström
2025-08-22  9:40 ` [PATCH v2 10/16] drm/xe/display: Convert __xe_pin_fb_vma() Thomas Hellström
2025-08-26 21:29   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 11/16] drm/xe: Convert xe_dma_buf.c for exhaustive eviction Thomas Hellström
2025-08-26 21:16   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 12/16] drm/xe: Rename ___xe_bo_create_locked() Thomas Hellström
2025-08-22  9:40 ` [PATCH v2 13/16] drm/xe: Convert xe_bo_create_pin_map_at() for exhaustive eviction Thomas Hellström
2025-08-26 21:27   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 14/16] drm/xe: Convert xe_bo_create_pin_map() " Thomas Hellström
2025-08-26 21:52   ` Matthew Brost
2025-09-02 13:32     ` Thomas Hellström
2025-09-03 18:03       ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 15/16] drm/xe/sriov: Convert pf_provision_vf_lmem " Thomas Hellström
2025-08-22 19:35   ` Matthew Brost
2025-08-22  9:40 ` [PATCH v2 16/16] drm/xe: Convert pinned suspend eviction " Thomas Hellström
2025-08-26 22:08   ` Matthew Brost
2025-08-22 10:50 ` ✗ CI.checkpatch: warning for Driver-managed exhaustive eviction (rev2) Patchwork
2025-08-22 10:51 ` ✓ CI.KUnit: success " Patchwork
2025-08-22 11:31 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-23  4:17 ` ✗ 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=20250822094030.3499-4-thomas.hellstrom@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=brian.welty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).