this fix the issue that access memory after freed
after driver unloaded.
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
        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;
 }
                                                        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;
        }