drm/amdkfd: Fix memory leak in create_process failure
authorjsg <jsg@openbsd.org>
Mon, 29 Apr 2024 06:37:08 +0000 (06:37 +0000)
committerjsg <jsg@openbsd.org>
Mon, 29 Apr 2024 06:37:08 +0000 (06:37 +0000)
From Felix Kuehling
aa02d43367a9adf8c85fb382fea4171fb266c8d0 in linux-6.6.y/6.6.29
18921b205012568b45760753ad3146ddb9e2d4e2 in mainline linux

sys/dev/pci/drm/amd/amdkfd/kfd_process.c

index fbf0530..7a1a574 100644 (file)
@@ -818,9 +818,9 @@ struct kfd_process *kfd_create_process(struct task_struct *thread)
        mutex_lock(&kfd_processes_mutex);
 
        if (kfd_is_locked()) {
-               mutex_unlock(&kfd_processes_mutex);
                pr_debug("KFD is locked! Cannot create process");
-               return ERR_PTR(-EINVAL);
+               process = ERR_PTR(-EINVAL);
+               goto out;
        }
 
        /* A prior open of /dev/kfd could have already created the process. */