OSDN Git Service

drm/amdgpu: Fix kernel NULL pointer dereference when amdgpu fini
authorRex Zhu <Rex.Zhu@amd.com>
Tue, 20 Mar 2018 08:28:56 +0000 (16:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Mar 2018 04:44:21 +0000 (23:44 -0500)
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/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c

index 4fa869b..a824d5d 100644 (file)
@@ -1752,7 +1752,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);
index 11dfe57..3a5ca46 100644 (file)
@@ -259,6 +259,7 @@ void amdgpu_irq_fini(struct amdgpu_device *adev)
                        }
                }
                kfree(adev->irq.client[i].sources);
+               adev->irq.client[i].sources = NULL;
        }
 }