Skip to content

Commit 2b55ddf

Browse files
Thomas Hellströmrodrigovivi
authored andcommitted
drm/xe/vm: Clear the scratch_pt pointer on error
Avoid triggering a dereference of an error pointer on cleanup in xe_vm_free_scratch() by clearing any scratch_pt error pointer. Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Fixes: 06951c2 ("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+ Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250821143045.106005-4-thomas.hellstrom@linux.intel.com (cherry picked from commit 358ee50) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 7551865 commit 2b55ddf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,8 +1610,12 @@ static int xe_vm_create_scratch(struct xe_device *xe, struct xe_tile *tile,
16101610

16111611
for (i = MAX_HUGEPTE_LEVEL; i < vm->pt_root[id]->level; i++) {
16121612
vm->scratch_pt[id][i] = xe_pt_create(vm, tile, i);
1613-
if (IS_ERR(vm->scratch_pt[id][i]))
1614-
return PTR_ERR(vm->scratch_pt[id][i]);
1613+
if (IS_ERR(vm->scratch_pt[id][i])) {
1614+
int err = PTR_ERR(vm->scratch_pt[id][i]);
1615+
1616+
vm->scratch_pt[id][i] = NULL;
1617+
return err;
1618+
}
16151619

16161620
xe_pt_populate_empty(tile, vm, vm->scratch_pt[id][i]);
16171621
}

0 commit comments

Comments
 (0)