drm/amd/display: fix null pointer access in gpu reset
authorGuchun Chen <guchun.chen@amd.com>
Mon, 28 Jun 2021 09:08:00 +0000 (17:08 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 1 Jul 2021 04:03:13 +0000 (00:03 -0400)
commitb66596f62665e8ef9a26508f2dc938289eac6d0c
tree01d8bacf30c76859d388a71cf6c341610bb6b4d1
parente38ca7e422791a4d1c01e56dbf7f9982db0ed365
drm/amd/display: fix null pointer access in gpu reset

During GPU reset, when receiving a DMCUB OUTBUX0 interrupt,
DAL code will set it to be OUTBOX interrupt and sets hw interrupt.
However, OUTBOX interrupt is not registered yet, so a NULL pointer
access will be executed.

Call Trace:
  dal_irq_service_set+0x30/0x90 [amdgpu]
  dc_interrupt_set+0x24/0x30 [amdgpu]
  amdgpu_dm_set_dmub_outbox_irq_state+0x22/0x30 [amdgpu]
  amdgpu_irq_update+0x77/0xa0 [amdgpu]
  amdgpu_irq_gpu_reset_resume_helper+0x67/0xa0 [amdgpu]
  amdgpu_do_asic_reset+0x219/0x260 [amdgpu]
  amdgpu_device_gpu_recover.cold+0x8c5/0xb64 [amdgpu]
  amdgpu_debugfs_gpu_recover_show+0x2c/0x60 [amdgpu]
  seq_read_iter+0xc2/0x450
  ? do_anonymous_page+0x22c/0x3b0
  seq_read+0xf9/0x140
  full_proxy_read+0x5c/0x90
  vfs_read+0xaa/0x190
  ksys_read+0x67/0xe0
  __x64_sys_read+0x1a/0x20

Fixes: effbf6ca7eafda ("drm/amdgpu/display: remove an old DCN3 guard")

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-and-tested-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/irq/irq_service.c