All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
@ 2016-12-05 20:07 Alex Deucher
       [not found] ` <1480968458-2270-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Alex Deucher @ 2016-12-05 20:07 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alex Deucher

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 the following Oops:

[    9.627636] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
[    9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100 [amdgpu]
[    9.628867] PGD 2514c7067
[    9.628876] PUD 2514c8067
[    9.629448] PMD 0
[    9.630026] Oops: 0000 [#1] PREEMPT SMP
[...]
[    9.639906] Call Trace:
[    9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
[    9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
[    9.641900]  ? kmalloc_order_trace+0x2e/0x100
[    9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
[    9.643355]  drm_dev_register+0xa7/0xd0
[    9.644016]  drm_get_pci_dev+0xde/0x1d0
[    9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
[...]

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

Port of Nicolai Stange's radeon patch to amdgpu.

bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915
Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 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 4701d94..a578540 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2512,9 +2512,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
@@ -2529,9 +2526,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.5.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
  2016-12-05  8:48 [PATCH] drm/radeon: " Christian König
@ 2016-12-05 20:30 ` Nicolai Stange
  2016-12-05 20:33     ` Deucher, Alexander
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolai Stange @ 2016-12-05 20:30 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Alex Deucher, Christian König, Michel Dänzer,
	linux-kernel, dri-devel, Nicolai Stange

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
  2016-12-05 20:30 ` [PATCH] drm/amdgpu: " Nicolai Stange
@ 2016-12-05 20:33     ` Deucher, Alexander
  0 siblings, 0 replies; 10+ messages in thread
From: Deucher, Alexander @ 2016-12-05 20:33 UTC (permalink / raw)
  To: 'Nicolai Stange', Daniel Vetter
  Cc: Michel Dänzer, Koenig, Christian,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org

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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
@ 2016-12-05 20:33     ` Deucher, Alexander
  0 siblings, 0 replies; 10+ messages in thread
From: Deucher, Alexander @ 2016-12-05 20:33 UTC (permalink / raw)
  To: 'Nicolai Stange', Daniel Vetter
  Cc: Koenig, Christian, Michel Dänzer,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
       [not found] ` <1480968458-2270-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2016-12-06  1:00   ` Michel Dänzer
       [not found]     ` <8a8380a1-fb41-e4e9-8c30-7ea075a241ac-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Michel Dänzer @ 2016-12-06  1:00 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Alex Deucher, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 06/12/16 05:07 AM, Alex Deucher wrote:
> 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 the following Oops:
> 
> [    9.627636] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
> [    9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100 [amdgpu]
> [    9.628867] PGD 2514c7067
> [    9.628876] PUD 2514c8067
> [    9.629448] PMD 0
> [    9.630026] Oops: 0000 [#1] PREEMPT SMP
> [...]
> [    9.639906] Call Trace:
> [    9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
> [    9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
> [    9.641900]  ? kmalloc_order_trace+0x2e/0x100
> [    9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
> [    9.643355]  drm_dev_register+0xa7/0xd0
> [    9.644016]  drm_get_pci_dev+0xde/0x1d0
> [    9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
> [...]
> 
> Fix this by omitting the drm_debugfs_create_files() call for the
> control minor debugfs directory which is now non-existent anyway.
> 
> Port of Nicolai Stange's radeon patch to amdgpu.
> 
> bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915

Not sure about the kernel, but in other projects the convention is

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98915


> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Regardless of the above,

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
  2016-12-05 20:33     ` Deucher, Alexander
  (?)
@ 2016-12-06  2:01     ` Mike Lothian
  2016-12-06  7:17         ` Daniel Vetter
  -1 siblings, 1 reply; 10+ messages in thread
From: Mike Lothian @ 2016-12-06  2:01 UTC (permalink / raw)
  To: Deucher, Alexander, Nicolai Stange, Daniel Vetter
  Cc: Michel Dänzer, Koenig, Christian,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org


[-- Attachment #1.1: Type: text/plain, Size: 3013 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 5797 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
  2016-12-06  2:01     ` Mike Lothian
@ 2016-12-06  7:17         ` Daniel Vetter
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Vetter @ 2016-12-06  7:17 UTC (permalink / raw)
  To: Mike Lothian
  Cc: Michel Dänzer, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, Nicolai Stange,
	Deucher, Alexander, Daniel Vetter, Koenig, Christian

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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
@ 2016-12-06  7:17         ` Daniel Vetter
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Vetter @ 2016-12-06  7:17 UTC (permalink / raw)
  To: Mike Lothian
  Cc: Deucher, Alexander, Nicolai Stange, Daniel Vetter,
	Michel Dänzer, Koenig, Christian,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
       [not found]     ` <8a8380a1-fb41-e4e9-8c30-7ea075a241ac-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2016-12-06  7:59       ` Christian König
       [not found]         ` <65ba1d07-7c50-c0d8-4d1b-bcdc7d447a63-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Christian König @ 2016-12-06  7:59 UTC (permalink / raw)
  To: Michel Dänzer, Alex Deucher
  Cc: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 06.12.2016 um 02:00 schrieb Michel Dänzer:
> On 06/12/16 05:07 AM, Alex Deucher wrote:
>> 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 the following Oops:
>>
>> [    9.627636] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
>> [    9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100 [amdgpu]
>> [    9.628867] PGD 2514c7067
>> [    9.628876] PUD 2514c8067
>> [    9.629448] PMD 0
>> [    9.630026] Oops: 0000 [#1] PREEMPT SMP
>> [...]
>> [    9.639906] Call Trace:
>> [    9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
>> [    9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
>> [    9.641900]  ? kmalloc_order_trace+0x2e/0x100
>> [    9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
>> [    9.643355]  drm_dev_register+0xa7/0xd0
>> [    9.644016]  drm_get_pci_dev+0xde/0x1d0
>> [    9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
>> [...]
>>
>> Fix this by omitting the drm_debugfs_create_files() call for the
>> control minor debugfs directory which is now non-existent anyway.
>>
>> Port of Nicolai Stange's radeon patch to amdgpu.
>>
>> bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915
> Not sure about the kernel, but in other projects the convention is
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98915
>
>
>> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Regardless of the above,
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>.

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] drm/amdgpu: don't add files at control minor debugfs directory
       [not found]         ` <65ba1d07-7c50-c0d8-4d1b-bcdc7d447a63-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-12-08  9:52           ` Shawn Starr
  0 siblings, 0 replies; 10+ messages in thread
From: Shawn Starr @ 2016-12-08  9:52 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Alex Deucher, Alex Deucher, Christian König,
	Michel Dänzer, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tuesday, December 6, 2016 8:59:09 AM EST Christian König wrote:
> Am 06.12.2016 um 02:00 schrieb Michel Dänzer:
> > On 06/12/16 05:07 AM, Alex Deucher wrote:
> >> 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 the following Oops:
> >> 
> >> [    9.627636] BUG: unable to handle kernel NULL pointer dereference at
> >> 0000000000000018 [    9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100
> >> [amdgpu]
> >> [    9.628867] PGD 2514c7067
> >> [    9.628876] PUD 2514c8067
> >> [    9.629448] PMD 0
> >> [    9.630026] Oops: 0000 [#1] PREEMPT SMP
> >> [...]
> >> [    9.639906] Call Trace:
> >> [    9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
> >> [    9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
> >> [    9.641900]  ? kmalloc_order_trace+0x2e/0x100
> >> [    9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
> >> [    9.643355]  drm_dev_register+0xa7/0xd0
> >> [    9.644016]  drm_get_pci_dev+0xde/0x1d0
> >> [    9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
> >> [...]
> >> 
> >> Fix this by omitting the drm_debugfs_create_files() call for the
> >> control minor debugfs directory which is now non-existent anyway.
> >> 
> >> Port of Nicolai Stange's radeon patch to amdgpu.
> >> 
> >> bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915
> > 
> > Not sure about the kernel, but in other projects the convention is
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98915
> > 
> >> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> >> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > 
> > Regardless of the above,
> > 
> > Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>.
> 

Worked fine, fixed the issue for me.

Tested-by: Shawn Starr <shawn.starr@rogers.com>

> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-12-08  9:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-05 20:07 [PATCH] drm/amdgpu: don't add files at control minor debugfs directory Alex Deucher
     [not found] ` <1480968458-2270-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2016-12-06  1:00   ` Michel Dänzer
     [not found]     ` <8a8380a1-fb41-e4e9-8c30-7ea075a241ac-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-12-06  7:59       ` Christian König
     [not found]         ` <65ba1d07-7c50-c0d8-4d1b-bcdc7d447a63-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-12-08  9:52           ` Shawn Starr
  -- strict thread matches above, loose matches on Subject: below --
2016-12-05  8:48 [PATCH] drm/radeon: " Christian König
2016-12-05 20:30 ` [PATCH] drm/amdgpu: " Nicolai Stange
2016-12-05 20:33   ` Deucher, Alexander
2016-12-05 20:33     ` Deucher, Alexander
2016-12-06  2:01     ` Mike Lothian
2016-12-06  7:17       ` Daniel Vetter
2016-12-06  7:17         ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.