From daa6cf7d72337707c1742d24a3a9e301f7713c41 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 29 Apr 2024 06:37:08 +0000 Subject: [PATCH] drm/amdkfd: Fix memory leak in create_process failure 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_process.c b/sys/dev/pci/drm/amd/amdkfd/kfd_process.c index fbf053001af..7a1a574106f 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_process.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_process.c @@ -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. */ -- 2.20.1