drm/amdgpu: Fix potential null pointer derefernce
authorjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:32:22 +0000 (02:32 +0000)
committerjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:32:22 +0000 (02:32 +0000)
From Stanley Yang
9b70fc7d70e8ef7c4a65034c9487f58609e708a1 in linux-6.1.y/6.1.64
80285ae1ec8717b597b20de38866c29d84d321a1 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c

index 9573eb6..3aec924 100644 (file)
@@ -5466,7 +5466,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
         * Flush RAM to disk so that after reboot
         * the user can read log and see why the system rebooted.
         */
-       if (need_emergency_restart && amdgpu_ras_get_context(adev)->reboot) {
+       if (need_emergency_restart && amdgpu_ras_get_context(adev) &&
+               amdgpu_ras_get_context(adev)->reboot) {
                DRM_WARN("Emergency reboot.");
 
 #ifdef notyet