drm/amdkfd: NULL dereference involving create_process()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 10:58:53 +0000 (13:58 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Wed, 14 Jun 2017 10:58:53 +0000 (13:58 +0300)
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>
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index 84d1ffd1eef950480804f2bba8bc4ceabcef1998..1190d06884ed3ce4f944b8befcd9744547a1c6d9 100644 (file)
@@ -318,7 +318,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;