drm/amdkfd: NULL dereference involving create_process()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 10:58:53 +0000 (13:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:16 +0000 (19:48 +0200)
[ 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 <dan.carpenter@oracle.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index ef7c8de7060e2dab64b7f7739b8c8286ea741711..171480bb95d0ffba492298b41aa9ef4d299aa672 100644 (file)
@@ -317,7 +317,8 @@ static struct kfd_process *create_process(const struct task_struct *thread)
 
        /* init process apertures*/
        process->is_32bit_user_mode = in_compat_syscall();
-       if (kfd_init_apertures(process) != 0)
+       err = kfd_init_apertures(process);
+       if (err != 0)
                goto err_init_apretures;
 
        return process;