[1/6] drm/amdgpu: fix mutex list null pointer reference

Submitted by Yu, Xiangliang on May 4, 2017, 6:34 a.m.

Details

Message ID 1493879668-26947-1-git-send-email-Xiangliang.Yu@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 3 2 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Yu, Xiangliang May 4, 2017, 6:34 a.m.
From: Pixel Ding <Pixel.Ding@amd.com>

Fix NULL pointer reference.

Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index e685ca9..aef2019 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2118,7 +2118,8 @@  void amdgpu_device_fini(struct amdgpu_device *adev)
 
 	DRM_INFO("amdgpu: finishing device.\n");
 	adev->shutdown = true;
-	drm_crtc_force_disable_all(adev->ddev);
+	if (adev->ddev->mode_config.funcs)
+		drm_crtc_force_disable_all(adev->ddev);
 	/* evict vram memory */
 	amdgpu_bo_evict_vram(adev);
 	amdgpu_ib_pool_fini(adev);

Comments

> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Xiangliang Yu

> Sent: Thursday, May 04, 2017 2:34 AM

> To: amd-gfx@lists.freedesktop.org

> Cc: Ding, Pixel; Yu, Xiangliang

> Subject: [PATCH 1/6] drm/amdgpu: fix mutex list null pointer reference

> 

> From: Pixel Ding <Pixel.Ding@amd.com>

> 

> Fix NULL pointer reference.

> 

> Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>

> Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>

> ---

>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> index e685ca9..aef2019 100644

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> @@ -2118,7 +2118,8 @@ void amdgpu_device_fini(struct amdgpu_device

> *adev)

> 

>  	DRM_INFO("amdgpu: finishing device.\n");

>  	adev->shutdown = true;

> -	drm_crtc_force_disable_all(adev->ddev);

> +	if (adev->ddev->mode_config.funcs)

> +		drm_crtc_force_disable_all(adev->ddev);


For consistency, I think we generally check for adev->mode_info.mode_confg_initialized or adev->mode_info.num_crtc.  Either way:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


>  	/* evict vram memory */

>  	amdgpu_bo_evict_vram(adev);

>  	amdgpu_ib_pool_fini(adev);

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx