diff options
author | 2020-08-22 04:28:19 +0000 | |
---|---|---|
committer | 2020-08-22 04:28:19 +0000 | |
commit | 08c8b0d621b56231ce747cefb4436e790c702397 (patch) | |
tree | 9fca179758c680bf366bbd28210c8c2a7e4c35cf /sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c | |
parent | Leave default ifq_maxlen handling to ifq_init() (diff) | |
download | wireguard-openbsd-08c8b0d621b56231ce747cefb4436e790c702397.tar.xz wireguard-openbsd-08c8b0d621b56231ce747cefb4436e790c702397.zip |
drm/amdgpu: avoid dereferencing a NULL pointer
From Jack Xiao
df1bd56e839e2461df3b0699a66d482e45ce2679 in linux 5.7.y/5.7.16
55611b507fd6453d26030c0c0619fdf0c262766d in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c index 495138ff339..db3f288a633 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c @@ -420,7 +420,9 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, ring->fence_drv.gpu_addr = adev->uvd.inst[ring->me].gpu_addr + index; } amdgpu_fence_write(ring, atomic_read(&ring->fence_drv.last_seq)); - amdgpu_irq_get(adev, irq_src, irq_type); + + if (irq_src) + amdgpu_irq_get(adev, irq_src, irq_type); ring->fence_drv.irq_src = irq_src; ring->fence_drv.irq_type = irq_type; @@ -546,8 +548,9 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) /* no need to trigger GPU reset as we are unloading */ amdgpu_fence_driver_force_completion(ring); } - amdgpu_irq_put(adev, ring->fence_drv.irq_src, - ring->fence_drv.irq_type); + if (ring->fence_drv.irq_src) + amdgpu_irq_put(adev, ring->fence_drv.irq_src, + ring->fence_drv.irq_type); drm_sched_fini(&ring->sched); del_timer_sync(&ring->fence_drv.fallback_timer); for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) @@ -583,8 +586,9 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev) } /* disable the interrupt */ - amdgpu_irq_put(adev, ring->fence_drv.irq_src, - ring->fence_drv.irq_type); + if (ring->fence_drv.irq_src) + amdgpu_irq_put(adev, ring->fence_drv.irq_src, + ring->fence_drv.irq_type); } } @@ -610,8 +614,9 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev) continue; /* enable the interrupt */ - amdgpu_irq_get(adev, ring->fence_drv.irq_src, - ring->fence_drv.irq_type); + if (ring->fence_drv.irq_src) + amdgpu_irq_get(adev, ring->fence_drv.irq_src, + ring->fence_drv.irq_type); } } |