gpu/drm/radeon: fix two memleaks in radeon_vm_init
authorjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:44:25 +0000 (01:44 +0000)
committerjsg <jsg@openbsd.org>
Mon, 29 Jan 2024 01:44:25 +0000 (01:44 +0000)
From Zhipeng Lu
4c9a96dd6d4acaa18146f5b1de457fec1004628c in linux-6.6.y/6.6.14
c2709b2d6a537ca0fa0f1da36fdaf07e48ef447d in mainline linux

sys/dev/pci/drm/radeon/radeon_vm.c

index 13006f5..5ffd331 100644 (file)
@@ -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,
                             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;
        }