gpu/drm/radeon: fix two memleaks in radeon_vm_init
[ Upstream commit c2709b2d6a537ca0fa0f1da36fdaf07e48ef447d ] 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: 6d2f2944e95e ("drm/radeon: use normal BOs for the page tables v4") Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2c55f7a8a4
commit
059584f01a
1 changed files with 6 additions and 2 deletions
|
@ -1206,13 +1206,17 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
|
|||
r = radeon_bo_create(rdev, pd_size, align, true,
|
||||
RADEON_GEM_DOMAIN_VRAM, 0, NULL,
|
||||
NULL, &vm->page_directory);
|
||||
if (r)
|
||||
if (r) {
|
||||
kfree(vm->page_tables);
|
||||
vm->page_tables = NULL;
|
||||
return r;
|
||||
|
||||
}
|
||||
r = radeon_vm_clear_bo(rdev, vm->page_directory);
|
||||
if (r) {
|
||||
radeon_bo_unref(&vm->page_directory);
|
||||
vm->page_directory = NULL;
|
||||
kfree(vm->page_tables);
|
||||
vm->page_tables = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue