Commit c7b1243e authored by Felix Kuehling's avatar Felix Kuehling Committed by Oded Gabbay

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: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent 851a645e
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/mm.h> #include <linux/sched/mm.h>
#include <linux/sched/task.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/amd-iommu.h> #include <linux/amd-iommu.h>
#include <linux/notifier.h> #include <linux/notifier.h>
...@@ -191,6 +192,8 @@ static void kfd_process_wq_release(struct work_struct *work) ...@@ -191,6 +192,8 @@ static void kfd_process_wq_release(struct work_struct *work)
mutex_destroy(&p->mutex); mutex_destroy(&p->mutex);
put_task_struct(p->lead_thread);
kfree(p); kfree(p);
kfree(work); kfree(work);
...@@ -342,6 +345,7 @@ static struct kfd_process *create_process(const struct task_struct *thread) ...@@ -342,6 +345,7 @@ static struct kfd_process *create_process(const struct task_struct *thread)
(uintptr_t)process->mm); (uintptr_t)process->mm);
process->lead_thread = thread->group_leader; process->lead_thread = thread->group_leader;
get_task_struct(process->lead_thread);
INIT_LIST_HEAD(&process->per_device_data); INIT_LIST_HEAD(&process->per_device_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment