drm/amdkfd: Fix error codes in kfd_get_process
authorWei Lu <wei.lu2@amd.com>
Thu, 12 Jul 2018 02:32:47 +0000 (22:32 -0400)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 12 Jul 2018 02:32:47 +0000 (22:32 -0400)
Return ERR_PTR(-EINVAL) if kfd_get_process fails to find the process.
This fixes kernel oopses when a child process calls KFD ioctls with
a file descriptor inherited from the parent process.

Signed-off-by: Wei Lu <wei.lu2@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index 1d80b4f7c681cc990fc2e60cb48dc52f8758977c..4694386cc6236238df2230be18a7173ab1bd86af 100644 (file)
@@ -244,6 +244,8 @@ struct kfd_process *kfd_get_process(const struct task_struct *thread)
                return ERR_PTR(-EINVAL);
 
        process = find_process(thread);
+       if (!process)
+               return ERR_PTR(-EINVAL);
 
        return process;
 }