drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions
authorRex Zhu <Rex.Zhu@amd.com>
Tue, 20 Mar 2018 08:32:07 +0000 (16:32 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Mar 2018 04:44:50 +0000 (23:44 -0500)
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]

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
drivers/gpu/drm/amd/amdgpu/si_dpm.c

index 98d1dd25359644a5811ed1f374f99264614148fe..47ef3e6e71786e8fed371518c70444f76084bd5b 100644 (file)
@@ -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;
index 81babe026529af0143694381a6e6a1854f7bdd3f..26ba984ab2b7cf1073bda2849af7ecbee8806803 100644 (file)
@@ -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;
index 3bfcf0d257ab717168f08778d7e569c2ec9ae89a..672eaffac0a54af22f3eea92c04e7057dc703720 100644 (file)
@@ -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;
 }