Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1536398 > unrolled thread

[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

Started byNicolai Stange <nicstange@gmail.com>
First post2016-12-05 21:40 +0100
Last post2016-12-06 08:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] drm/amdgpu: don't add files at control minor debugfs directory Nicolai Stange <nicstange@gmail.com> - 2016-12-05 21:40 +0100
    RE: [PATCH] drm/amdgpu: don't add files at control minor debugfs  directory "Deucher, Alexander" <Alexander.Deucher@amd.com> - 2016-12-05 21:40 +0100
      Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs  directory Daniel Vetter <daniel@ffwll.ch> - 2016-12-06 08:20 +0100

#1536398 — [PATCH] drm/amdgpu: don't add files at control minor debugfs directory

FromNicolai Stange <nicstange@gmail.com>
Date2016-12-05 21:40 +0100
Subject[PATCH] drm/amdgpu: don't add files at control minor debugfs directory
Message-ID<sL8dj-QU-17@gated-at.bofh.it>
Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
struct drm_device's ->control member is always NULL.

In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
->control->debugfs_root though. This results in a NULL pointer
dereference.

Fix this by omitting the drm_debugfs_create_files() call for the
control minor debugfs directory which is now non-existent anyway.

Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
---
Applicable to next-20161202. Compile-only tested.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index deee2db..0cb3e82 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct amdgpu_device *adev,
 	adev->debugfs_count = i;
 #if defined(CONFIG_DEBUG_FS)
 	drm_debugfs_create_files(files, nfiles,
-				 adev->ddev->control->debugfs_root,
-				 adev->ddev->control);
-	drm_debugfs_create_files(files, nfiles,
 				 adev->ddev->primary->debugfs_root,
 				 adev->ddev->primary);
 #endif
@@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct amdgpu_device *adev)
 	for (i = 0; i < adev->debugfs_count; i++) {
 		drm_debugfs_remove_files(adev->debugfs[i].files,
 					 adev->debugfs[i].num_files,
-					 adev->ddev->control);
-		drm_debugfs_remove_files(adev->debugfs[i].files,
-					 adev->debugfs[i].num_files,
 					 adev->ddev->primary);
 	}
 #endif
-- 
2.10.2

[toc] | [next] | [standalone]


#1536399 — RE: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory

From"Deucher, Alexander" <Alexander.Deucher@amd.com>
Date2016-12-05 21:40 +0100
SubjectRE: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
Message-ID<sL8dj-QU-15@gated-at.bofh.it>
In reply to#1536398
> -----Original Message-----
> From: Nicolai Stange [mailto:nicstange@gmail.com]
> Sent: Monday, December 05, 2016 3:30 PM
> To: Daniel Vetter
> Cc: Deucher, Alexander; Koenig, Christian; Michel Dänzer; linux-
> kernel@vger.kernel.org; dri-devel@lists.freedesktop.org; Nicolai Stange
> Subject: [PATCH] drm/amdgpu: don't add files at control minor debugfs
> directory
> 
> Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> struct drm_device's ->control member is always NULL.
> 
> In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> ->control->debugfs_root though. This results in a NULL pointer
> dereference.
> 
> Fix this by omitting the drm_debugfs_create_files() call for the
> control minor debugfs directory which is now non-existent anyway.
> 
> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> Signed-off-by: Nicolai Stange <nicstange@gmail.com>

Please add the bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=98915
With that,
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
> Applicable to next-20161202. Compile-only tested.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index deee2db..0cb3e82 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct
> amdgpu_device *adev,
>  	adev->debugfs_count = i;
>  #if defined(CONFIG_DEBUG_FS)
>  	drm_debugfs_create_files(files, nfiles,
> -				 adev->ddev->control->debugfs_root,
> -				 adev->ddev->control);
> -	drm_debugfs_create_files(files, nfiles,
>  				 adev->ddev->primary->debugfs_root,
>  				 adev->ddev->primary);
>  #endif
> @@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct
> amdgpu_device *adev)
>  	for (i = 0; i < adev->debugfs_count; i++) {
>  		drm_debugfs_remove_files(adev->debugfs[i].files,
>  					 adev->debugfs[i].num_files,
> -					 adev->ddev->control);
> -		drm_debugfs_remove_files(adev->debugfs[i].files,
> -					 adev->debugfs[i].num_files,
>  					 adev->ddev->primary);
>  	}
>  #endif
> --
> 2.10.2

[toc] | [prev] | [next] | [standalone]


#1536708 — Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-12-06 08:20 +0100
SubjectRe: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
Message-ID<sLicG-7oX-33@gated-at.bofh.it>
In reply to#1536399
On Tue, Dec 06, 2016 at 02:01:37AM +0000, Mike Lothian wrote:
> Feel free to add a tested by from myself
> 
> Thanks for the fix
> 
> On Mon, 5 Dec 2016 at 20:33 Deucher, Alexander <Alexander.Deucher@amd.com>
> wrote:
> 
> > > -----Original Message-----
> > > From: Nicolai Stange [mailto:nicstange@gmail.com]
> > > Sent: Monday, December 05, 2016 3:30 PM
> > > To: Daniel Vetter
> > > Cc: Deucher, Alexander; Koenig, Christian; Michel Dänzer; linux-
> > > kernel@vger.kernel.org; dri-devel@lists.freedesktop.org; Nicolai Stange
> > > Subject: [PATCH] drm/amdgpu: don't add files at control minor debugfs
> > > directory
> > >
> > > Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> > > struct drm_device's ->control member is always NULL.
> > >
> > > In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> > > ->control->debugfs_root though. This results in a NULL pointer
> > > dereference.
> > >
> > > Fix this by omitting the drm_debugfs_create_files() call for the
> > > control minor debugfs directory which is now non-existent anyway.
> > >
> > > Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> > > Signed-off-by: Nicolai Stange <nicstange@gmail.com>
> >
> > Please add the bugzilla:
> > https://bugs.freedesktop.org/show_bug.cgi?id=98915
> > With that,
> > Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Applied to drm-misc, thanks for catching this and sorry for the fallout I
caused.
-Daniel

> >
> > > ---
> > > Applicable to next-20161202. Compile-only tested.
> > >
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ------
> > >  1 file changed, 6 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > index deee2db..0cb3e82 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > @@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct
> > > amdgpu_device *adev,
> > >       adev->debugfs_count = i;
> > >  #if defined(CONFIG_DEBUG_FS)
> > >       drm_debugfs_create_files(files, nfiles,
> > > -                              adev->ddev->control->debugfs_root,
> > > -                              adev->ddev->control);
> > > -     drm_debugfs_create_files(files, nfiles,
> > >                                adev->ddev->primary->debugfs_root,
> > >                                adev->ddev->primary);
> > >  #endif
> > > @@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct
> > > amdgpu_device *adev)
> > >       for (i = 0; i < adev->debugfs_count; i++) {
> > >               drm_debugfs_remove_files(adev->debugfs[i].files,
> > >                                        adev->debugfs[i].num_files,
> > > -                                      adev->ddev->control);
> > > -             drm_debugfs_remove_files(adev->debugfs[i].files,
> > > -                                      adev->debugfs[i].num_files,
> > >                                        adev->ddev->primary);
> > >       }
> > >  #endif
> > > --
> > > 2.10.2
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >

> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web