Skip to contentSkip to conversation

drm/amdgpu:fix virtual dce bug

PATCH In review Monk Liu 2 participants 2 messages Nov 15, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu:fix virtual dce bug

this fix the issue that access memory after freed
after driver unloaded.

Change-Id I64e2488c18f5dc044b57c74567785da21fc028da
---
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +3 -1
index a8829af..39460eb 100644
@@ -437,6 +437,8 @@ static int dce_virtual_sw_fini(void *handle)
 	drm_kms_helper_poll_fini(adev->ddev);
 
 	drm_mode_config_cleanup(adev->ddev);
+	/* clear crtcs pointer to avoid dce irq finish routine access freed data */
+	memset(adev->mode_info.crtcs, 0, sizeof(adev->mode_info.crtcs[0]) * AMDGPU_MAX_CRTCS);
 	adev->mode_info.mode_config_initialized = false;
 	return 0;
 }
@@ -723,7 +725,7 @@ static void dce_virtual_set_crtc_vblank_interrupt_state(struct amdgpu_device *ad
 							int crtc,
 							enum amdgpu_interrupt_state state)
 {
-	if (crtc >= adev->mode_info.num_crtc) {
+	if (crtc >= adev->mode_info.num_crtc || !adev->mode_info.crtcs[crtc]) {
 		DRM_DEBUG("invalid crtc %d\n", crtc);
 		return;
 	}
Signature · 6 lines
2.7.4

_______________________________________________
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): 1510737076-8485-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Acked-by Alex Deucher
#2 lore raw
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Wednesday, November 15, 2017 4:11 AM
To: [email protected]
Cc: Liu, Monk
Subject: [PATCH] drm/amdgpu:fix virtual dce bug

Quoted 5 lines

this fix the issue that access memory after freed
after driver unloaded.

Change-Id I64e2488c18f5dc044b57c74567785da21fc028da
Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +2 -0
index a8829af..39460eb 100644
@@ -437,6 +437,8 @@ static int dce_virtual_sw_fini(void *handle)
 	drm_kms_helper_poll_fini(adev->ddev);
 
 	drm_mode_config_cleanup(adev->ddev);
+	/* clear crtcs pointer to avoid dce irq finish routine access freed data
 */
+	memset(adev->mode_info.crtcs, 0, sizeof(adev-
 >mode_info.crtcs[0]) * AMDGPU_MAX_CRTCS);
 	adev->mode_info.mode_config_initialized = false;
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0 -0
 	return 0;
 }
@@ -723,7 +725,7 @@ static void

dce_virtual_set_crtc_vblank_interrupt_state(struct amdgpu_device *ad

drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0 -0
 							int crtc,
 							enum

amdgpu_interrupt_state state)
{

drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -1
-	if (crtc >= adev->mode_info.num_crtc) {
+	if (crtc >= adev->mode_info.num_crtc || !adev-
Quoted 1 line

mode_info.crtcs[crtc]) {

drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0 -1
 		DRM_DEBUG("invalid crtc %d\n", crtc);
 		return;
 	}
--

2.7.4

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