Return-Path: Received: from mail-by2nam03on0139.outbound.protection.outlook.com ([104.47.42.139]:32544 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934993AbeCSQDX (ORCPT ); Mon, 19 Mar 2018 12:03:23 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Dan Carpenter , Oded Gabbay , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 180/281] drm/amdkfd: NULL dereference involving create_process() Date: Mon, 19 Mar 2018 16:01:25 +0000 Message-ID: <20180319155742.13731-180-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Dan Carpenter [ Upstream commit b312b2b25b6ac9e2eb03f4ca651b33108752de3a ] We accidentally return ERR_PTR(0) which is NULL. The caller is not expecting that and it leads to an Oops. Fixes: dd59239a9862 ("amdkfd: init aperture once per process") Signed-off-by: Dan Carpenter Reviewed-by: Felix Kuehling Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd= /amdkfd/kfd_process.c index ef7c8de7060e..171480bb95d0 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -317,7 +317,8 @@ static struct kfd_process *create_process(const struct = task_struct *thread) =20 /* init process apertures*/ process->is_32bit_user_mode =3D in_compat_syscall(); - if (kfd_init_apertures(process) !=3D 0) + err =3D kfd_init_apertures(process); + if (err !=3D 0) goto err_init_apretures; =20 return process; --=20 2.14.1