Commit c2709b2d authored by Zhipeng Lu's avatar Zhipeng Lu Committed by Alex Deucher

gpu/drm/radeon: fix two memleaks in radeon_vm_init

When radeon_bo_create and radeon_vm_clear_bo fail, the vm->page_tables
allocated before need to be freed. However, neither radeon_vm_init
itself nor its caller have done such deallocation.

Fixes: 6d2f2944 ("drm/radeon: use normal BOs for the page tables v4")
Signed-off-by: default avatarZhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 28dd7883
...@@ -1204,13 +1204,17 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) ...@@ -1204,13 +1204,17 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
r = radeon_bo_create(rdev, pd_size, align, true, r = radeon_bo_create(rdev, pd_size, align, true,
RADEON_GEM_DOMAIN_VRAM, 0, NULL, RADEON_GEM_DOMAIN_VRAM, 0, NULL,
NULL, &vm->page_directory); NULL, &vm->page_directory);
if (r) if (r) {
kfree(vm->page_tables);
vm->page_tables = NULL;
return r; return r;
}
r = radeon_vm_clear_bo(rdev, vm->page_directory); r = radeon_vm_clear_bo(rdev, vm->page_directory);
if (r) { if (r) {
radeon_bo_unref(&vm->page_directory); radeon_bo_unref(&vm->page_directory);
vm->page_directory = NULL; vm->page_directory = NULL;
kfree(vm->page_tables);
vm->page_tables = NULL;
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment