drm/xe/vm: Fix an error path
Subsystems (2)
Thomas Hellström
maintainerPATCH v2 1/1 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 <[email protected]>
Closes https://lore.kernel.org/intel-xe/jrwua7ckbiozfcaodx4gg2h4taiuxs53j5zlpf3qzvyhyiyl2d@pbs3plurokrj/ open here
Suggested-by Dafna Hirschfeld <[email protected]>
Fixes 9f232f4ae249 ("drm/xe: Port Xe to GPUVA")
Signed-off-by Thomas Hellström <[email protected]>
Acked-by Lucas De Marchi <[email protected]>
--- drivers/gpu/drm/xe/xe_vm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_vm.c +5 -3
@@ -2063,9 +2063,11 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,if (err)return ERR_PTR (err); - vm_bo =drm_gpuvm_bo_find (&vm->gpuvm, obj); -if (!vm_bo) -break ; + vm_bo =drm_gpuvm_bo_obtain (&vm->gpuvm, obj); +if (IS_ERR (vm_bo)) { +xe_bo_unlock (bo); +return ERR_CAST (vm_bo); + } ops =drm_gpuvm_bo_unmap_ops_create (vm_bo);drm_gpuvm_bo_put (vm_bo);
Signature · 1 line
2.42.0