⬢ DragonFlyBSD Kernel Audit
DF-4976 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/amdgpu/mxgpu_ai.c
+++ b/sys/dev/drm/amd/amdgpu/mxgpu_ai.c
@@ -364,5 +364,10 @@ int xgpu_ai_mailbox_get_irq(struct amdgp
 
 void xgpu_ai_mailbox_put_irq(struct amdgpu_device *adev)
 {
+	/* Drain any FLR work queued by the RCV irq before the device goes
+	 * away: put_irq runs from soc15_common_hw_fini() on detach, suspend
+	 * and gpu recovery, and a surviving flr_work would touch adev
+	 * (lock_reset, MMIO peeks, amdgpu_device_gpu_recover) after teardown
+	 * or free (DF-4976). Same idiom as reset_work in amdgpu_irq.c.
+	 */
+	cancel_work_sync(&adev->virt.flr_work);
 	amdgpu_irq_put(adev, &adev->virt.ack_irq, 0);
 	amdgpu_irq_put(adev, &adev->virt.rcv_irq, 0);
 }