aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3407-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3407-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3407-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3407-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3407-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch
new file mode 100644
index 00000000..14aff642
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3407-drm-amdkfd-Get-reference-to-lead_thread-task-struct.patch
@@ -0,0 +1,49 @@
+From d93d3fff4ccb1e0d679dfe5c1171bbfb75a4bbb0 Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Mon, 27 Nov 2017 18:29:50 -0500
+Subject: [PATCH 3407/4131] drm/amdkfd: Get reference to lead_thread task
+ struct
+
+Increment the kfd_process.lead_thread's reference counter to make
+it safe to dereference. This is needed for getting a safe reference
+to the process' mm_struct.
+
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
+Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_process.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+index 99c18ee..660d8bc 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+@@ -24,6 +24,7 @@
+ #include <linux/log2.h>
+ #include <linux/sched.h>
+ #include <linux/sched/mm.h>
++#include <linux/sched/task.h>
+ #include <linux/slab.h>
+ #include <linux/amd-iommu.h>
+ #include <linux/notifier.h>
+@@ -191,6 +192,8 @@ static void kfd_process_wq_release(struct work_struct *work)
+
+ mutex_destroy(&p->mutex);
+
++ put_task_struct(p->lead_thread);
++
+ kfree(p);
+
+ kfree(work);
+@@ -342,6 +345,7 @@ static struct kfd_process *create_process(const struct task_struct *thread)
+ (uintptr_t)process->mm);
+
+ process->lead_thread = thread->group_leader;
++ get_task_struct(process->lead_thread);
+
+ INIT_LIST_HEAD(&process->per_device_data);
+
+--
+2.7.4
+