Skip to contentSkip to conversation

drm/amdkfd: NULL dereference involving create_process()

PATCH Applied Dan Carpenter 4 participants 4 messages Jun 14, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: NULL dereference involving create_process()

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")
drivers/gpu/drm/amd/amdkfd/kfd_process.c +2 -1
index 84d1ffd1eef9..1190d06884ed 100644
@@ -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;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, June 14, 2017 6:59 AM
To: Oded Gabbay; Alexey Skidanov
Cc: Deucher, Alexander; Koenig, Christian; David Airlie; dri- [email protected]; [email protected]; kernel- [email protected]
Subject: [PATCH] drm/amdkfd: NULL dereference involving create_process()

Quoted 5 lines

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")

Include Felix.

Alex

Quoted 17 lines
drivers/gpu/drm/amd/amdkfd/kfd_process.c +2 -1
index 84d1ffd1eef9..1190d06884ed 100644
@@ -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;

maintainer
#2 lore raw

Yeah, I saw this earlier. I'm on the amd-gfx list.

The patch looks good to me. Feel free to add my R-b. Do you want to apply it to amd-staging-4.11 and drm-next? I can take care of amd-kfd-staging and the release branches.

Thanks,
Felix

Quoted 37 lines · Alexander
Quoted 9 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, June 14, 2017 6:59 AM
To: Oded Gabbay; Alexey Skidanov
Cc: Deucher, Alexander; Koenig, Christian; David Airlie; dri- [email protected]; [email protected]; kernel- [email protected]
Subject: [PATCH] drm/amdkfd: NULL dereference involving create_process()

Quoted 5 lines

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")

Include Felix.

Alex

drivers/gpu/drm/amd/amdkfd/kfd_process.c static struct kfd_process *create_process(const

Quoted 7 lines
drivers/gpu/drm/amd/amdkfd/kfd_process.c +0 -0
index 84d1ffd1eef9..1190d06884ed 100644
@@ -318,7 +318,8 @@ static struct kfd_process *create_process(const

struct

Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_process.c +2 -1
 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;
Applied
#3 lore raw
In reply to Dan Carpenter
Quoted 12 lines · Dan Carpenter

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")
drivers/gpu/drm/amd/amdkfd/kfd_process.c +0 -0
index 84d1ffd1eef9..1190d06884ed 100644

drivers/gpu/drm/amd/amdkfd/kfd_process.c static struct kfd_process *create_process(const struct task_struct *thread) · line 325

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_process.c +2 -1
@@ -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;

Hi Dan,

Applied to amdkfd-next
Thanks!

Oded