From: Wei Lu Date: Thu, 12 Jul 2018 02:32:47 +0000 (-0400) Subject: drm/amdkfd: Fix error codes in kfd_get_process X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e47cb828eb3fca3e8999a0b9aa053dda18552071;p=openwrt%2Fstaging%2Fblogic.git drm/amdkfd: Fix error codes in kfd_get_process 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 Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Acked-by: Christian König 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 1d80b4f7c681..4694386cc623 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -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; }