diff options
author | Felix Kuehling <felix.kuehling@amd.com> | 2024-04-10 15:52:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-27 17:13:03 +0200 |
commit | 0dcd876411644da98a6b4d5a18d32ca94c15bdb5 (patch) | |
tree | b8976a3a7a6a5ff15c1f0e4a699ffa19defc81e1 | |
parent | b1f04b9b1c5317f562a455384c5f7473e46bdbaa (diff) | |
download | linux-stable-0dcd876411644da98a6b4d5a18d32ca94c15bdb5.tar.gz linux-stable-0dcd876411644da98a6b4d5a18d32ca94c15bdb5.tar.bz2 linux-stable-0dcd876411644da98a6b4d5a18d32ca94c15bdb5.zip |
drm/amdkfd: Fix memory leak in create_process failure
commit 18921b205012568b45760753ad3146ddb9e2d4e2 upstream.
Fix memory leak due to a leaked mmget reference on an error handling
code path that is triggered when attempting to create KFD processes
while a GPU reset is in progress.
Fixes: 0ab2d7532b05 ("drm/amdkfd: prepare per-process debug enable and disable")
CC: Xiaogang Chen <xiaogang.chen@amd.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Tested-by: Harish Kasiviswanthan <Harish.Kasiviswanthan@amd.com>
Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_process.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 717a60d7a4ea..b79986412cd8 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -819,9 +819,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. */ |