Skip to contentSkip to conversation

drm/amdgpu: Fix kernel NULL pointer dereference when amdgpu fini

PATCH In review Rex Zhu 2 participants 3 messages Mar 20, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/2 drm/amdgpu: Fix kernel NULL pointer dereference when amdgpu fini

Change-Id Ibef63da7a4725651065fd316385c8521ec31897b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c    | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -1
index 5bb88aa..f105116 100644
@@ -1493,7 +1493,8 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
 			continue;
 
 		if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
-			adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) {
+			adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE &&
+			adev->ip_blocks[i].version->funcs->set_clockgating_state) {
 			/* ungate blocks before hw fini so that we can shutdown the blocks safely */
 			r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,
 										     AMD_CG_STATE_UNGATE);
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -0
index 11dfe57..3a5ca46 100644
@@ -259,6 +259,7 @@ void amdgpu_irq_fini(struct amdgpu_device *adev)
 			}
 		}
 		kfree(adev->irq.client[i].sources);
+		adev->irq.client[i].sources = NULL;
 	}
 }
 
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): 1521535031-3100-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions

caused by
'commit 83e3c4615872 ("drm/amdgpu: Remove wrapper layer of smu ip functions")'

BUG: unable to handle kernel NULL pointer dereference at 00000000000005d8
[  313.241459] IP: ci_dpm_read_sensor+0x37/0xf0 [amdgpu]
Change-Id Iac0cf26264ccbc60181ccd9bba79fe3c4e420456
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 1 +
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 1 +
 drivers/gpu/drm/amd/amdgpu/si_dpm.c | 1 +
 3 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -0
index 98d1dd2..47ef3e6 100644
@@ -6244,6 +6244,7 @@ static int ci_dpm_early_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	adev->powerplay.pp_funcs = &ci_dpm_funcs;
+	adev->powerplay.pp_handle = adev;
 	ci_dpm_set_irq_funcs(adev);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1 -0
index 81babe0..26ba984 100644
@@ -2963,6 +2963,7 @@ static int kv_dpm_early_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	adev->powerplay.pp_funcs = &kv_dpm_funcs;
+	adev->powerplay.pp_handle = adev;
 	kv_dpm_set_irq_funcs(adev);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/si_dpm.c +1 -0
index 3bfcf0d..672eaff 100644
@@ -7917,6 +7917,7 @@ static int si_dpm_early_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	adev->powerplay.pp_funcs = &si_dpm_funcs;
+	adev->powerplay.pp_handle = adev;
 	si_dpm_set_irq_funcs(adev);
 	return 0;
 }
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): 1521535031-3100-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions

Series is:

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Tuesday, March 20, 2018 4:37:11 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 2/2] drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions

caused by
'commit 83e3c4615872 ("drm/amdgpu: Remove wrapper layer of smu ip functions")'

BUG: unable to handle kernel NULL pointer dereference at 00000000000005d8
[  313.241459] IP: ci_dpm_read_sensor+0x37/0xf0 [amdgpu]
Change-Id Iac0cf26264ccbc60181ccd9bba79fe3c4e420456
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 1 +
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 1 +
 drivers/gpu/drm/amd/amdgpu/si_dpm.c | 1 +
 3 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -0
index 98d1dd2..47ef3e6 100644
@@ -6244,6 +6244,7 @@ static int ci_dpm_early_init(void *handle)
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
         adev->powerplay.pp_funcs = &ci_dpm_funcs;
+       adev->powerplay.pp_handle = adev;
         ci_dpm_set_irq_funcs(adev);
 
         return 0;
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1 -0
index 81babe0..26ba984 100644
@@ -2963,6 +2963,7 @@ static int kv_dpm_early_init(void *handle)
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
         adev->powerplay.pp_funcs = &kv_dpm_funcs;
+       adev->powerplay.pp_handle = adev;
         kv_dpm_set_irq_funcs(adev);
 
         return 0;
drivers/gpu/drm/amd/amdgpu/si_dpm.c +1 -0
index 3bfcf0d..672eaff 100644
@@ -7917,6 +7917,7 @@ static int si_dpm_early_init(void *handle)
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
         adev->powerplay.pp_funcs = &si_dpm_funcs;
+       adev->powerplay.pp_handle = adev;
         si_dpm_set_irq_funcs(adev);
         return 0;
 }

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