diff mbox

drm/amdkfd: NULL dereference involving create_process()

Message ID 20170614105853.GP29394@elgon.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter June 14, 2017, 10:58 a.m. UTC
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>

Comments

Deucher, Alexander June 14, 2017, 4:41 p.m. UTC | #1
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Wednesday, June 14, 2017 6:59 AM
> To: Oded Gabbay; Alexey Skidanov
> Cc: Deucher, Alexander; Koenig, Christian; David Airlie; dri-
> devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH] 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Include Felix.

Alex

> 
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 84d1ffd1eef9..1190d06884ed 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -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;
Felix Kuehling June 14, 2017, 6:34 p.m. UTC | #2
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


On 17-06-14 12:41 PM, Deucher, Alexander wrote:
> > -----Original Message-----
> > From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> > Sent: Wednesday, June 14, 2017 6:59 AM
> > To: Oded Gabbay; Alexey Skidanov
> > Cc: Deucher, Alexander; Koenig, Christian; David Airlie; dri-
> > devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; kernel-
> > janitors@vger.kernel.org
> > Subject: [PATCH] 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")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Include Felix.
>
> Alex
>
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > index 84d1ffd1eef9..1190d06884ed 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > @@ -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;
Oded Gabbay June 14, 2017, 8:34 p.m. UTC | #3
On Wed, Jun 14, 2017 at 1:58 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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>
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 84d1ffd1eef9..1190d06884ed 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -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
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 84d1ffd1eef9..1190d06884ed 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -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;