GPU falls of the bus then the kernel deadlocks in nvidia-modeset

When the GPU crashes by falling of the bus, the driver doesn’t cleanup properly user processes which are using the Nvidia GPU, so the last process which is using the GPU is getting stuck in the kernel forever leaving the system in a inconsistent state where I can’t do a clean shutdown/reboot, kill this process (even with kill -9) or unload the Nvidia modules.

GPU: GTX 1060
Kernel: 6.18.9-arch1-2 (Arch Linux)
Nvidia drivers: 580.126.18

nvidia-bug-report.log.gz (1.4 MB)