From: Felix Kuehling Date: Mon, 27 Nov 2017 23:29:50 +0000 (-0500) Subject: drm/amdkfd: Get reference to lead_thread task struct X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=c7b1243eef128c49aabdfab71cd4f5ecb6602d97;p=openwrt%2Fstaging%2Fblogic.git 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 Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 99c18ee65a76..660d8bcb93e0 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -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);