Skip to content

Commit 84603ed

Browse files
Thomas Hellströmgregkh
authored andcommitted
drm/xe/vm: Clear the scratch_pt pointer on error
commit 2b55ddf upstream. 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 <[email protected]> Fixes: 06951c2 ("drm/xe: Use NULL PTEs as scratch PTEs") Cc: Brian Welty <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: <[email protected]> # v6.8+ Reviewed-by: Matthew Brost <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit 358ee50ab565f3c8ea32480e9d03127a81ba32f8) Signed-off-by: Rodrigo Vivi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 39fc274 commit 84603ed

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
@@ -1582,8 +1582,12 @@ static int xe_vm_create_scratch(struct xe_device *xe, struct xe_tile *tile,
15821582

15831583
for (i = MAX_HUGEPTE_LEVEL; i < vm->pt_root[id]->level; i++) {
15841584
vm->scratch_pt[id][i] = xe_pt_create(vm, tile, i);
1585-
if (IS_ERR(vm->scratch_pt[id][i]))
1586-
return PTR_ERR(vm->scratch_pt[id][i]);
1585+
if (IS_ERR(vm->scratch_pt[id][i])) {
1586+
int err = PTR_ERR(vm->scratch_pt[id][i]);
1587+
1588+
vm->scratch_pt[id][i] = NULL;
1589+
return err;
1590+
}
15871591

15881592
xe_pt_populate_empty(tile, vm, vm->scratch_pt[id][i]);
15891593
}

0 commit comments

Comments
 (0)