Skip to content

Commit 457f443

Browse files
author
Thomas Hellström
committed
drm/xe/vm: Fix an error path
If using the VM_BIND_OP_UNMAP_ALL without any bound vmas for the vm, we will end up dereferencing an uninitialized variable and leak a bo lock. Fix this. v2: - Updated commit message (Lucas De Marchi) Reported-by: Dafna Hirschfeld <dhirschfeld@habana.ai> Closes: https://lore.kernel.org/intel-xe/jrwua7ckbiozfcaodx4gg2h4taiuxs53j5zlpf3qzvyhyiyl2d@pbs3plurokrj/ Suggested-by: Dafna Hirschfeld <dhirschfeld@habana.ai> Fixes: b06d47b ("drm/xe: Port Xe to GPUVA") Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Acked-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231222175904.16732-1-thomas.hellstrom@linux.intel.com (cherry picked from commit 9d0c1c5) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent 56c253d commit 457f443

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,9 +2063,11 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
20632063
if (err)
20642064
return ERR_PTR(err);
20652065

2066-
vm_bo = drm_gpuvm_bo_find(&vm->gpuvm, obj);
2067-
if (!vm_bo)
2068-
break;
2066+
vm_bo = drm_gpuvm_bo_obtain(&vm->gpuvm, obj);
2067+
if (IS_ERR(vm_bo)) {
2068+
xe_bo_unlock(bo);
2069+
return ERR_CAST(vm_bo);
2070+
}
20692071

20702072
ops = drm_gpuvm_bo_unmap_ops_create(vm_bo);
20712073
drm_gpuvm_bo_put(vm_bo);

0 commit comments

Comments
 (0)