]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.8/drm-amdkfd-fix-memory-leak-in-create_process-failure.patch
6.8-stable patches
[thirdparty/kernel/stable-queue.git] / queue-6.8 / drm-amdkfd-fix-memory-leak-in-create_process-failure.patch
1 From 18921b205012568b45760753ad3146ddb9e2d4e2 Mon Sep 17 00:00:00 2001
2 From: Felix Kuehling <felix.kuehling@amd.com>
3 Date: Wed, 10 Apr 2024 15:52:10 -0400
4 Subject: drm/amdkfd: Fix memory leak in create_process failure
5
6 From: Felix Kuehling <felix.kuehling@amd.com>
7
8 commit 18921b205012568b45760753ad3146ddb9e2d4e2 upstream.
9
10 Fix memory leak due to a leaked mmget reference on an error handling
11 code path that is triggered when attempting to create KFD processes
12 while a GPU reset is in progress.
13
14 Fixes: 0ab2d7532b05 ("drm/amdkfd: prepare per-process debug enable and disable")
15 CC: Xiaogang Chen <xiaogang.chen@amd.com>
16 Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
17 Tested-by: Harish Kasiviswanthan <Harish.Kasiviswanthan@amd.com>
18 Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
19 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
20 Cc: stable@vger.kernel.org
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
27 +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
28 @@ -819,9 +819,9 @@ struct kfd_process *kfd_create_process(s
29 mutex_lock(&kfd_processes_mutex);
30
31 if (kfd_is_locked()) {
32 - mutex_unlock(&kfd_processes_mutex);
33 pr_debug("KFD is locked! Cannot create process");
34 - return ERR_PTR(-EINVAL);
35 + process = ERR_PTR(-EINVAL);
36 + goto out;
37 }
38
39 /* A prior open of /dev/kfd could have already created the process. */