Skip to contentSkip to conversation

drm/amd/display: fix NULL pointer dereference.

PATCH In review Rex Zhu 3 participants 3 messages Apr 5, 2017 – Apr 6, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/display: fix NULL pointer dereference.

on vega10, driver can run into a NULL-pointer dereference.

Change-Id I8e2de5343f804d6e736f620ff6d3d6e6488fb970
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 62be159..8f5951f 100644
@@ -1095,7 +1095,8 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 			DRM_ERROR("KMS: Failed to allocate surface\n");
 			goto fail_free_planes;
 		}
-		mode_info->planes[i]->plane_type = mode_info->plane_type[i];
+		if (mode_info->plane_type != NULL)
+			mode_info->planes[i]->plane_type = mode_info->plane_type[i];
 		if (amdgpu_dm_plane_init(dm, mode_info->planes[i], 1)) {
 			DRM_ERROR("KMS: Failed to initialize plane\n");
 			goto fail_free_planes;
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1491378913-20768-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Tony Cheng Reviewed-by Roman Li
#2 lore raw

The issue seems already fixed by the following commit {{{
commit 52184bbf4773512d7c83fe21a0b4b4ec4be27caf

Author: Jordan Lazare <[email protected]>
Date:   Wed Apr 5 15:05:51 2017 -0400

drm/amd/display: fix nullptr on vega initialization

Change-Id Ic5062d9b9e7ad3406c8ed0acfe0e2f222ce17634

}}}

Regards,
Evan

Quoted 34 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Wednesday, April 05, 2017 3:55 PM
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH] drm/amd/display: fix NULL pointer dereference.

on vega10, driver can run into a NULL-pointer dereference.

Change-Id I8e2de5343f804d6e736f620ff6d3d6e6488fb970

---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 62be159..8f5951f 100644
@@ -1095,7 +1095,8 @@ int amdgpu_dm_initialize_drm_device(struct
 amdgpu_device *adev)
 			DRM_ERROR("KMS: Failed to allocate surface\n");
 			goto fail_free_planes;
 		}
-		mode_info->planes[i]->plane_type = mode_info-
 >plane_type[i];
+		if (mode_info->plane_type != NULL)
+			mode_info->planes[i]->plane_type = mode_info-
 >plane_type[i];
		if (amdgpu_dm_plane_init(dm, mode_info->planes[i], 1)) {
			DRM_ERROR("KMS: Failed to initialize plane\n");
			goto fail_free_planes;
Quoted 7 lines

--
1.9.1

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

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

Reviewed-by Junwei Zhang
#3 lore raw
In reply to a message not in the archive
Quoted 22 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Wednesday, April 05, 2017 15:55
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amd/display: fix NULL pointer dereference.

on vega10, driver can run into a NULL-pointer dereference.

Change-Id I8e2de5343f804d6e736f620ff6d3d6e6488fb970
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 62be159..8f5951f 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c int amdgpu_dm_initialize_drm_device(struct · line 1099

Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -1095,7 +1095,8 @@ int amdgpu_dm_initialize_drm_device(struct
 amdgpu_device *adev)
 			DRM_ERROR("KMS: Failed to allocate surface\n");
 			goto fail_free_planes;
 		}
-		mode_info->planes[i]->plane_type = mode_info->plane_type[i];
+		if (mode_info->plane_type != NULL)

We can simplify it like:
if (mode_info->plane_type)

With that fix,

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
+			mode_info->planes[i]->plane_type = mode_info-
 >plane_type[i];
 		if (amdgpu_dm_plane_init(dm, mode_info->planes[i], 1)) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
 			DRM_ERROR("KMS: Failed to initialize plane\n");
 			goto fail_free_planes;
--

1.9.1

Quoted 4 lines

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

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